]> Sergey Matveev's repositories - btrtrc.git/commitdiff
When updating requests, only tickle writer if there are no requests pending
authorMatt Joiner <anacrolix@gmail.com>
Sat, 18 Sep 2021 11:01:06 +0000 (21:01 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sat, 18 Sep 2021 11:01:06 +0000 (21:01 +1000)
Just a quick attempt to reduce load for now. There'll be a much better way to do this.

peerconn.go

index 4eca560e35dd96bd933c77dda716bd05c82201da..452166ac69042337e9f3d1ea854ecac2d6b923bf 100644 (file)
@@ -653,6 +653,9 @@ func (cn *PeerConn) postBitfield() {
 }
 
 func (cn *PeerConn) updateRequests() {
+       if len(cn.actualRequestState.Requests) != 0 {
+               return
+       }
        cn.tickleWriter()
 }