]> Sergey Matveev's repositories - btrtrc.git/blob - peer.go
Dynamic outbound max requests
[btrtrc.git] / peer.go
1 package torrent
2
3 func (p *Peer) isLowOnRequests() bool {
4         return p.requestState.Requests.IsEmpty() && p.requestState.Cancelled.IsEmpty()
5 }
6
7 func (p *Peer) decPeakRequests() {
8         // // This can occur when peak requests are altered by the update request timer to be lower than
9         // // the actual number of outstanding requests. Let's let it go negative and see what happens. I
10         // // wonder what happens if maxRequests is not signed.
11         // if p.peakRequests < 1 {
12         //      panic(p.peakRequests)
13         // }
14         p.peakRequests--
15 }