fix DeleteTestGossipConnection
This is a one-sided operation, so we shouldn't be touching the remote's Peers. Also fix the associated test... When both 1 and 2 have lost their connection to 3, they no longer have a route to 3 and hence gc it. And because they no longer have a route, gossip from them won't get through to 3.
This commit is contained in:
1 parent
5401037743
commit
81df06b3f4
1 file changed
+3
-15
+3
-15
@@ -65,16 +65,9 @@ func (router *Router) NewTestGossipConnection(r *Router) *mockGossipConnection {
|
||||
}
|
||||
|
||||
func (router *Router) DeleteTestGossipConnection(r *Router) {
|
||||
fromName := router.Ourself.Peer.Name
|
||||
toName := r.Ourself.Peer.Name
|
||||
|
||||
fromPeer := r.Peers.Fetch(fromName)
|
||||
toPeer := router.Peers.Fetch(toName)
|
||||
|
||||
r.Peers.Dereference(fromPeer)
|
||||
router.Peers.Dereference(toPeer)
|
||||
|
||||
conn, _ := router.Ourself.ConnectionTo(toName)
|
||||
router.Peers.Dereference(conn.Remote())
|
||||
router.Ourself.handleDeleteConnection(conn)
|
||||
}
|
||||
|
||||
@@ -136,15 +129,10 @@ func TestGossipTopology(t *testing.T) {
|
||||
// Drop the connection from 1 to 3
|
||||
r1.DeleteTestGossipConnection(r3)
|
||||
sendPendingGossip(r1, r2, r3)
|
||||
checkTopology(t, r1, r1.tp(r2), r2.tp(r1), r3.tp(r1, r2))
|
||||
checkTopology(t, r2, r1.tp(r2), r2.tp(r1), r3.tp(r1, r2))
|
||||
checkTopology(t, r1, r1.tp(r2), r2.tp(r1))
|
||||
checkTopology(t, r2, r1.tp(r2), r2.tp(r1))
|
||||
// r3 still thinks r1 has a connection to it
|
||||
checkTopology(t, r3, r1.tp(r2, r3), r2.tp(r1), r3.tp(r1, r2))
|
||||
|
||||
// On a timer, r3 will gossip to r1
|
||||
r3.SendAllGossip()
|
||||
sendPendingGossip(r1, r2, r3)
|
||||
checkTopology(t, r1, r1.tp(r2), r2.tp(r1), r3.tp(r1, r2))
|
||||
}
|
||||
|
||||
func TestGossipSurrogate(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user