Drop peer request alloc reservations when peer is closed

Might fix a goroutine leak.
This commit is contained in:
Matt Joiner 2023-05-03 16:40:35 +10:00
parent c202126a62
commit 12db16c478
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
1 changed files with 3 additions and 0 deletions

View File

@ -324,6 +324,9 @@ func (p *Peer) close() {
if p.updateRequestsTimer != nil {
p.updateRequestsTimer.Stop()
}
for _, prs := range p.peerRequests {
prs.allocReservation.Drop()
}
p.peerImpl.onClose()
if p.t != nil {
p.t.decPeerPieceAvailability(p)