Skip to content

Commit

Permalink
cleanup peerresponsetracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Nov 18, 2024
1 parent ecd68dd commit ea61bc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bitswap/client/internal/session/peerresponsetracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ func (prt *peerResponseTracker) getPeerCount(p peer.ID) int {
// will be chosen
return prt.firstResponder[p] + 1
}

// cleanup stops tracking a peer
func (prt *peerResponseTracker) cleanup(p peer.ID) {
delete(prt.firstResponder, p)
}
1 change: 1 addition & 0 deletions bitswap/client/internal/session/sessionwantsender.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ func (sws *sessionWantSender) processAvailability(availability map[peer.ID]bool)
// Reset the count of consecutive DONT_HAVEs received from the
// peer
delete(sws.peerConsecutiveDontHaves, p)
sws.peerRspTrkr.cleanup(p)
}
}

Expand Down

0 comments on commit ea61bc6

Please sign in to comment.