From 8488646e7b258c91a56f589563aebd61fef0b98b Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 10 Sep 2014 16:42:33 +0100 Subject: [PATCH] refactor: change method/signal name --- connection.go | 2 +- connection_maker.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/connection.go b/connection.go index a88d7d42..d8fdc556 100644 --- a/connection.go +++ b/connection.go @@ -279,7 +279,7 @@ func (conn *LocalConnection) handleShutdown() { conn.stopForwarders() if conn.remote != nil { - conn.Router.ConnectionMaker.ShutdownConnection(conn.remoteTCPAddr) + conn.Router.ConnectionMaker.ConnectionTerminated(conn.remoteTCPAddr) } } diff --git a/connection_maker.go b/connection_maker.go index aa6f0440..a49d577f 100644 --- a/connection_maker.go +++ b/connection_maker.go @@ -15,9 +15,9 @@ const ( ) const ( - CMInitiate = iota - CMStatus = iota - CMFailed = iota + CMInitiate = iota + CMStatus = iota + CMTerminated = iota ) func StartConnectionMaker(router *Router) *ConnectionMaker { @@ -37,9 +37,9 @@ func (cm *ConnectionMaker) InitiateConnection(address string) { address: address} } -func (cm *ConnectionMaker) ShutdownConnection(address string) { +func (cm *ConnectionMaker) ConnectionTerminated(address string) { cm.queryChan <- &ConnectionMakerInteraction{ - Interaction: Interaction{code: CMFailed}, + Interaction: Interaction{code: CMTerminated}, address: address} } @@ -72,7 +72,7 @@ func (cm *ConnectionMaker) queryLoop(queryChan <-chan *ConnectionMakerInteractio maybeTick() case query.code == CMStatus: query.resultChan <- cm.status() - case query.code == CMFailed: + case query.code == CMTerminated: if target, found := cm.targets[query.address]; found { target.attempting = false target.tryAfter, target.tryInterval = tryAfter(target.tryInterval) @@ -177,7 +177,7 @@ func (cm *ConnectionMaker) attemptConnection(address string, acceptNewPeer bool) log.Println("Attempting connection to", address) if err := cm.router.Ourself.CreateConnection(address, acceptNewPeer); err != nil { log.Println(err) - cm.ShutdownConnection(address) + cm.ConnectionTerminated(address) } }