Skip to content

Commit ea61bc6

Browse files
committed
cleanup peerresponsetracker
1 parent ecd68dd commit ea61bc6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

bitswap/client/internal/session/peerresponsetracker.go

+5
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,8 @@ func (prt *peerResponseTracker) getPeerCount(p peer.ID) int {
6161
// will be chosen
6262
return prt.firstResponder[p] + 1
6363
}
64+
65+
// cleanup stops tracking a peer
66+
func (prt *peerResponseTracker) cleanup(p peer.ID) {
67+
delete(prt.firstResponder, p)
68+
}

bitswap/client/internal/session/sessionwantsender.go

+1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ func (sws *sessionWantSender) processAvailability(availability map[peer.ID]bool)
332332
// Reset the count of consecutive DONT_HAVEs received from the
333333
// peer
334334
delete(sws.peerConsecutiveDontHaves, p)
335+
sws.peerRspTrkr.cleanup(p)
335336
}
336337
}
337338

0 commit comments

Comments
 (0)