connection.go | 10 +++++++++- diff --git a/connection.go b/connection.go index c5c6c95743132debd5daec1457a04678b846c943..1d99664af7ab8b1652a5a27e804a53fbabcbf34d 100644 --- a/connection.go +++ b/connection.go @@ -975,7 +975,7 @@ piece.unpendChunkIndex(chunkIndex(req.chunkSpec, t.chunkSize)) // Cancel pending requests for this chunk. for c := range t.conns { - c.updateRequests() + c.postCancel(req) } cl.mu.Unlock() @@ -1103,3 +1103,11 @@ } func (c *connection) tickleWriter() { c.writerCond.Broadcast() } + +func (c *connection) postCancel(r request) bool { + if !c.deleteRequest(r) { + return false + } + c.Post(makeCancelMessage(r)) + return true +}