Fix returns when iterating over Connections()

d5eb76f32 replaced (*Peer)ForEachConnection into (*Peer)Connections(),
and consequently converted some nested functions into for loops.  But
the "return" statements in those nested functions were left as-was,
and so exited the outer function rather than moving on to the next
iteration.

Fixes #497
This commit is contained in:
David Wragg committed 2015-03-29 19:10:44 +01:00
1 parent d708cb7d4e
commit b00be096f7
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -136,7 +136,7 @@ func (cm *ConnectionMaker) checkStateAndAttemptConnections() time.Duration {
for _, conn := range peer.Connections() {
otherPeer := conn.Remote().Name
if otherPeer == cm.ourself.Name || ourConnectedPeers[otherPeer] {
return
continue
}
address := conn.RemoteTCPAddr()
// try both portnumber of connection and standard port. Don't use remote side of inbound connection.
+2 -2
View File
@@ -132,11 +132,11 @@ func (routes *Routes) calculateBroadcast() map[PeerName][]PeerName {
// locking.
for _, conn := range ourself.Connections() {
if !conn.Established() {
return
continue
}
remoteName := conn.Remote().Name
if _, found := reached[remoteName]; found {
return
continue
}
if remoteConn, found := conn.Remote().ConnectionTo(ourself.Name); found && remoteConn.Established() {
hops = append(hops, remoteName)