2021-12-23 21:55:57 +00:00
|
|
|
package torrent
|
|
|
|
|
2022-07-11 08:22:23 +00:00
|
|
|
type peerLocalPublicAddr = IpPort
|
|
|
|
|
2021-12-23 21:55:57 +00:00
|
|
|
func (p *Peer) isLowOnRequests() bool {
|
|
|
|
return p.requestState.Requests.IsEmpty() && p.requestState.Cancelled.IsEmpty()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Peer) decPeakRequests() {
|
|
|
|
// // This can occur when peak requests are altered by the update request timer to be lower than
|
|
|
|
// // the actual number of outstanding requests. Let's let it go negative and see what happens. I
|
|
|
|
// // wonder what happens if maxRequests is not signed.
|
|
|
|
// if p.peakRequests < 1 {
|
|
|
|
// panic(p.peakRequests)
|
|
|
|
// }
|
|
|
|
p.peakRequests--
|
|
|
|
}
|