projects
/
btrtrc.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b86c212
)
Don't cancel request on current peer when receiving chunk
author
Matt Joiner <anacrolix@gmail.com>
Thu, 28 Jan 2021 03:26:10 +0000 (14:26 +1100)
committer
Matt Joiner <anacrolix@gmail.com>
Thu, 28 Jan 2021 03:26:10 +0000 (14:26 +1100)
peerconn.go
patch
|
blob
|
history
diff --git
a/peerconn.go
b/peerconn.go
index ac43e8d5b4517a53510be9fc509b8bd6bcc88bfc..b994f3be7b95263dabb8c5e6b01036fc73764ecb 100644
(file)
--- a/
peerconn.go
+++ b/
peerconn.go
@@
-1403,10
+1403,13
@@
func (c *Peer) receiveChunk(msg *pp.Message) error {
// waiting for it to be written to storage.
piece.unpendChunkIndex(chunkIndex(req.ChunkSpec, t.chunkSize))
- // Cancel pending requests for this chunk.
- for c := range t.conns {
- c.postCancel(req)
- }
+ // Cancel pending requests for this chunk from *other* peers.
+ t.iterPeers(func(p *Peer) {
+ if p == c {
+ return
+ }
+ p.postCancel(req)
+ })
err := func() error {
cl.unlock()