refactor: change method/signal name
This commit is contained in:
1 parent
4e442393b2
commit
8488646e7b
2 files changed
+8
-8
No files matched your search
+1
-1
@@ -279,7 +279,7 @@ func (conn *LocalConnection) handleShutdown() {
|
|||||||
conn.stopForwarders()
|
conn.stopForwarders()
|
||||||
|
|
||||||
if conn.remote != nil {
|
if conn.remote != nil {
|
||||||
conn.Router.ConnectionMaker.ShutdownConnection(conn.remoteTCPAddr)
|
conn.Router.ConnectionMaker.ConnectionTerminated(conn.remoteTCPAddr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -15,9 +15,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CMInitiate = iota
|
CMInitiate = iota
|
||||||
CMStatus = iota
|
CMStatus = iota
|
||||||
CMFailed = iota
|
CMTerminated = iota
|
||||||
)
|
)
|
||||||
|
|
||||||
func StartConnectionMaker(router *Router) *ConnectionMaker {
|
func StartConnectionMaker(router *Router) *ConnectionMaker {
|
||||||
@@ -37,9 +37,9 @@ func (cm *ConnectionMaker) InitiateConnection(address string) {
|
|||||||
address: address}
|
address: address}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cm *ConnectionMaker) ShutdownConnection(address string) {
|
func (cm *ConnectionMaker) ConnectionTerminated(address string) {
|
||||||
cm.queryChan <- &ConnectionMakerInteraction{
|
cm.queryChan <- &ConnectionMakerInteraction{
|
||||||
Interaction: Interaction{code: CMFailed},
|
Interaction: Interaction{code: CMTerminated},
|
||||||
address: address}
|
address: address}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ func (cm *ConnectionMaker) queryLoop(queryChan <-chan *ConnectionMakerInteractio
|
|||||||
maybeTick()
|
maybeTick()
|
||||||
case query.code == CMStatus:
|
case query.code == CMStatus:
|
||||||
query.resultChan <- cm.status()
|
query.resultChan <- cm.status()
|
||||||
case query.code == CMFailed:
|
case query.code == CMTerminated:
|
||||||
if target, found := cm.targets[query.address]; found {
|
if target, found := cm.targets[query.address]; found {
|
||||||
target.attempting = false
|
target.attempting = false
|
||||||
target.tryAfter, target.tryInterval = tryAfter(target.tryInterval)
|
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)
|
log.Println("Attempting connection to", address)
|
||||||
if err := cm.router.Ourself.CreateConnection(address, acceptNewPeer); err != nil {
|
if err := cm.router.Ourself.CreateConnection(address, acceptNewPeer); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
cm.ShutdownConnection(address)
|
cm.ConnectionTerminated(address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user