Fix panic for unexpected piece rejections

Should fix #419.
This commit is contained in:
Matt Joiner 2020-09-03 14:34:06 +10:00
parent e992bb78b9
commit 4dee11efe9
1 changed files with 3 additions and 2 deletions

View File

@ -1160,9 +1160,10 @@ func (c *PeerConn) mainReadLoop() (err error) {
}
func (c *peer) remoteRejectedRequest(r request) {
c.deleteRequest(r)
if c.deleteRequest(r) {
c.decExpectedChunkReceive(r)
}
}
func (c *peer) decExpectedChunkReceive(r request) {
count := c.validReceiveChunks[r]