]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Only assert pending requests when check is enabled
authorMatt Joiner <anacrolix@gmail.com>
Tue, 26 Oct 2021 03:42:42 +0000 (14:42 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 26 Oct 2021 03:42:42 +0000 (14:42 +1100)
Uses too much CPU for production from its current callsites.

torrent.go

index d606971dffca4d08b80c8c6738dfb66979db3b40..5f18df1f3e9bacfd9dc9707fdbb6a4fc66f16bb5 100644 (file)
@@ -1408,6 +1408,9 @@ func (t *Torrent) numActivePeers() (num int) {
 }
 
 func (t *Torrent) assertPendingRequests() {
+       if !check {
+               return
+       }
        var actual pendingRequests
        if t.haveInfo() {
                actual.m = make([]int, t.numRequests())