Break checkStateAndAttemptConnections into phases, and track the end of all connection attempts

This commit is contained in:
Bryan Boreham committed 2014-09-10 14:50:43 +01:00
1 parent 9d0af9dbfe
commit 2050569fb6
3 files changed
+34 -55

No files matched your search

-12
View File
@@ -57,18 +57,6 @@ func (peer *Peer) ConnectionTo(name PeerName) (Connection, bool) {
return conn, found // yes, you really can't inline that. FFS.
}
func (peer *Peer) ConnectionOn(peerAddr string) (Connection, bool) {
peerAddr = NormalisePeerAddr(peerAddr)
peer.RLock()
defer peer.RUnlock()
for _, conn := range peer.connections {
if conn.RemoteTCPAddr() == peerAddr {
return conn, true
}
}
return nil, false
}
func (peer *Peer) ForEachConnection(fun func(PeerName, Connection)) {
peer.RLock()
defer peer.RUnlock()