move ConnectionTo from Peer to LocalPeer

further shrinking the former's API
This commit is contained in:
Matthias Radestock committed 2015-05-11 17:19:31 +01:00
1 parent 505ced5cc8
commit 0229185ffe
5 files changed
+14 -10

No files matched your search

+5 -1
View File
@@ -231,7 +231,11 @@ func (routes *Routes) calculateBroadcast(establishedAndSymmetric bool) map[PeerN
if _, found := reached[remoteName]; found {
continue
}
if remoteConn, found := conn.Remote().ConnectionTo(ourself.Name); !establishedAndSymmetric || (found && remoteConn.Established()) {
// conn.Remote() cannot by ourself. Modifying
// peer.connections requires a write lock on Peers,
// and since we are holding a read lock (due to the
// ForEach), access without locking the peer is safe.
if remoteConn, found := conn.Remote().connections[ourself.Name]; !establishedAndSymmetric || (found && remoteConn.Established()) {
hops = append(hops, remoteName)
}
}