delete mesh before sending prunes on leave

This commit is contained in:
vyzo 2018-02-20 14:12:52 +02:00 committed by Steven Allen
parent 64d35994d1
commit 0e288dc741

View File

@ -248,10 +248,11 @@ func (gs *GossipSubRouter) Leave(topic string) {
return return
} }
delete(gs.mesh, topic)
for p := range gmap { for p := range gmap {
gs.sendPrune(p, topic) gs.sendPrune(p, topic)
} }
delete(gs.mesh, topic)
} }
func (gs *GossipSubRouter) sendGraft(p peer.ID, topic string) { func (gs *GossipSubRouter) sendGraft(p peer.ID, topic string) {
@ -417,7 +418,7 @@ func (gs *GossipSubRouter) heartbeat() {
} }
} }
// do we need more peers // do we need more peers?
if len(peers) < GossipSubD { if len(peers) < GossipSubD {
ineed := GossipSubD - len(peers) ineed := GossipSubD - len(peers)
plst := gs.getPeers(topic, func(p peer.ID) bool { plst := gs.getPeers(topic, func(p peer.ID) bool {