forked from TrueCloudLab/neoneo-go
Merge pull request #2924 from nspcc-dev/drain-queues-on-disconnect
network: drain send queues on peer disconnection
This commit is contained in:
commit
31ee21a83a
1 changed files with 10 additions and 0 deletions
|
@ -250,6 +250,16 @@ func (p *TCPPeer) handleQueues() {
|
|||
p2pSkipCounter++
|
||||
}
|
||||
p.Disconnect(err)
|
||||
drainloop:
|
||||
for {
|
||||
select {
|
||||
case <-p.hpSendQ:
|
||||
case <-p.p2pSendQ:
|
||||
case <-p.sendQ:
|
||||
default:
|
||||
break drainloop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// StartProtocol starts a long running background loop that interacts
|
||||
|
|
Loading…
Reference in a new issue