File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -696,6 +696,16 @@ func (p *PubSub) handleDeadPeers() {
696696 }
697697
698698 close (ch )
699+ delete (p .peers , pid )
700+
701+ for t , tmap := range p .topics {
702+ if _ , ok := tmap [pid ]; ok {
703+ delete (tmap , pid )
704+ p .notifyLeave (t , pid )
705+ }
706+ }
707+
708+ p .rt .RemovePeer (pid )
699709
700710 if p .host .Network ().Connectedness (pid ) == network .Connected {
701711 backoffDelay , err := p .deadPeerBackoff .updateAndGet (pid )
@@ -709,20 +719,9 @@ func (p *PubSub) handleDeadPeers() {
709719 log .Debugf ("peer declared dead but still connected; respawning writer: %s" , pid )
710720 messages := make (chan * RPC , p .peerOutboundQueueSize )
711721 messages <- p .getHelloPacket ()
712- go p .handleNewPeerWithBackoff (p .ctx , pid , backoffDelay , messages )
713722 p .peers [pid ] = messages
714- continue
715- }
716-
717- delete (p .peers , pid )
718- for t , tmap := range p .topics {
719- if _ , ok := tmap [pid ]; ok {
720- delete (tmap , pid )
721- p .notifyLeave (t , pid )
722- }
723+ go p .handleNewPeerWithBackoff (p .ctx , pid , backoffDelay , messages )
723724 }
724-
725- p .rt .RemovePeer (pid )
726725 }
727726}
728727
You can’t perform that action at this time.
0 commit comments