Break checkStateAndAttemptConnections into phases, and track the end of all connection attempts
This commit is contained in:
1 parent
9d0af9dbfe
commit
2050569fb6
3 files changed
+34
-55
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user