peerconn.go | 7 +++++-- diff --git a/peerconn.go b/peerconn.go index e00006ffcb365380903a22bc7fcc60661d458fae..e683be5c46f1d876b8ad365bf8a917f408a07e49 100644 --- a/peerconn.go +++ b/peerconn.go @@ -1035,7 +1035,9 @@ return fmt.Errorf("received fast extension message (type=%v) but extension is disabled", msg.Type) } switch msg.Type { case pp.Choke: - c.peerChoking = true + if c.peerChoking { + break + } if !c.fastEnabled() { c.deleteAllRequests() } else { @@ -1046,6 +1048,7 @@ } return true }) } + c.peerChoking = true // We can then reset our interest. c.updateRequests("choked") c.updateExpectingChunks() @@ -1132,7 +1135,7 @@ r := i.Next() if r >= t.pieceRequestIndexOffset(pieceIndex+1) { break } - c.t.pendingRequests.Inc(i.Next()) + c.t.pendingRequests.Inc(r) } } c.updateRequests("PeerConn.mainReadLoop allowed fast")