Merge pull request #453 from rade/452_only_broadcast_on_established
LGTM. Fixes #452 - those messages go away entirely in my tests.
This commit is contained in:
commit
cce6175a5c
1 file changed
+7
-1
+7
-1
@@ -137,11 +137,17 @@ func (routes *Routes) calculateBroadcast() map[PeerName][]PeerName {
|
|||||||
routes.peers.ForEach(func(name PeerName, peer *Peer) {
|
routes.peers.ForEach(func(name PeerName, peer *Peer) {
|
||||||
hops := []PeerName{}
|
hops := []PeerName{}
|
||||||
if found, reached := peer.Routes(ourself, true); found {
|
if found, reached := peer.Routes(ourself, true); found {
|
||||||
|
// This is rather similar to the inner loop on
|
||||||
|
// peer.Routes(...); the main difference is in the
|
||||||
|
// locking.
|
||||||
ourself.ForEachConnection(func(remoteName PeerName, conn Connection) {
|
ourself.ForEachConnection(func(remoteName PeerName, conn Connection) {
|
||||||
|
if !conn.Established() {
|
||||||
|
return
|
||||||
|
}
|
||||||
if _, found := reached[remoteName]; found {
|
if _, found := reached[remoteName]; found {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, found := conn.Remote().ConnectionTo(ourself.Name); found {
|
if remoteConn, found := conn.Remote().ConnectionTo(ourself.Name); found && remoteConn.Established() {
|
||||||
hops = append(hops, remoteName)
|
hops = append(hops, remoteName)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user