don't share the outgoing channel in new stream handlers from disconnects
This commit is contained in:
parent
fc7795c38f
commit
f82af595dc
|
@ -316,15 +316,18 @@ func (p *PubSub) processLoop(ctx context.Context) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close(ch)
|
||||||
|
|
||||||
if p.host.Network().Connectedness(pid) == inet.Connected {
|
if p.host.Network().Connectedness(pid) == inet.Connected {
|
||||||
// still connected, must be a duplicate connection being closed.
|
// still connected, must be a duplicate connection being closed.
|
||||||
// we respawn the writer as we need to ensure there is a stream active
|
// we respawn the writer as we need to ensure there is a stream active
|
||||||
log.Warning("peer declared dead but still connected; respawning writer: ", pid)
|
log.Warning("peer declared dead but still connected; respawning writer: ", pid)
|
||||||
go p.handleNewPeer(ctx, pid, ch)
|
messages := make(chan *RPC, 32)
|
||||||
|
go p.handleNewPeer(ctx, pid, messages)
|
||||||
|
p.peers[pid] = messages
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
close(ch)
|
|
||||||
delete(p.peers, pid)
|
delete(p.peers, pid)
|
||||||
for _, t := range p.topics {
|
for _, t := range p.topics {
|
||||||
delete(t, pid)
|
delete(t, pid)
|
||||||
|
|
Loading…
Reference in New Issue