Disable update requests timer
This commit is contained in:
parent
590d1ac265
commit
669c69faac
|
@ -991,7 +991,9 @@ func (p *Peer) initUpdateRequestsTimer() {
|
||||||
panic(p.updateRequestsTimer)
|
panic(p.updateRequestsTimer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.updateRequestsTimer = time.AfterFunc(math.MaxInt64, p.updateRequestsTimerFunc)
|
if enableUpdateRequestsTimer {
|
||||||
|
p.updateRequestsTimer = time.AfterFunc(math.MaxInt64, p.updateRequestsTimerFunc)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const peerUpdateRequestsTimerReason = "updateRequestsTimer"
|
const peerUpdateRequestsTimerReason = "updateRequestsTimer"
|
||||||
|
|
|
@ -503,7 +503,7 @@ var (
|
||||||
|
|
||||||
// The actual value to use as the maximum outbound requests.
|
// The actual value to use as the maximum outbound requests.
|
||||||
func (cn *Peer) nominalMaxRequests() maxRequests {
|
func (cn *Peer) nominalMaxRequests() maxRequests {
|
||||||
return maxRequests(maxInt(1, minInt(cn.PeerMaxRequests, cn.peakRequests*2, maxLocalToRemoteRequests)))
|
return maxInt(1, minInt(cn.PeerMaxRequests, cn.peakRequests*2, maxLocalToRemoteRequests))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cn *Peer) totalExpectingTime() (ret time.Duration) {
|
func (cn *Peer) totalExpectingTime() (ret time.Duration) {
|
||||||
|
|
|
@ -312,9 +312,14 @@ func (p *Peer) applyRequestState(next desiredRequestState) {
|
||||||
p.peakRequests = newPeakRequests
|
p.peakRequests = newPeakRequests
|
||||||
p.needRequestUpdate = ""
|
p.needRequestUpdate = ""
|
||||||
p.lastRequestUpdate = time.Now()
|
p.lastRequestUpdate = time.Now()
|
||||||
p.updateRequestsTimer.Reset(updateRequestsTimerDuration)
|
if enableUpdateRequestsTimer {
|
||||||
|
p.updateRequestsTimer.Reset(updateRequestsTimerDuration)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This could be set to 10s to match the unchoke/request update interval recommended by some
|
// This could be set to 10s to match the unchoke/request update interval recommended by some
|
||||||
// specifications. I've set it shorter to trigger it more often for testing for now.
|
// specifications. I've set it shorter to trigger it more often for testing for now.
|
||||||
const updateRequestsTimerDuration = 3 * time.Second
|
const (
|
||||||
|
updateRequestsTimerDuration = 3 * time.Second
|
||||||
|
enableUpdateRequestsTimer = false
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue