From 4dee11efe95b3a368998ce9683e3c0e00decdd3c Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 3 Sep 2020 14:34:06 +1000 Subject: [PATCH] Fix panic for unexpected piece rejections Should fix #419. --- peerconn.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/peerconn.go b/peerconn.go index d344556c..adb60319 100644 --- a/peerconn.go +++ b/peerconn.go @@ -1160,8 +1160,9 @@ func (c *PeerConn) mainReadLoop() (err error) { } func (c *peer) remoteRejectedRequest(r request) { - c.deleteRequest(r) - c.decExpectedChunkReceive(r) + if c.deleteRequest(r) { + c.decExpectedChunkReceive(r) + } } func (c *peer) decExpectedChunkReceive(r request) {