Ignore the corner case when a piece is dropped from storage

This commit is contained in:
Matt Joiner 2016-02-26 22:12:13 +11:00
parent 811b460f1d
commit e33006a419
1 changed files with 5 additions and 1 deletions

View File

@ -1336,7 +1336,11 @@ another:
for r := range c.PeerRequests {
err := me.sendChunk(t, c, r)
if err != nil {
log.Printf("error sending chunk %+v to peer: %s", r, err)
if t.pieceComplete(int(r.Index)) && err == io.ErrUnexpectedEOF {
// We had the piece, but not anymore.
} else {
log.Printf("error sending chunk %+v to peer: %s", r, err)
}
// If we failed to send a chunk, choke the peer to ensure they
// flush all their requests. We've probably dropped a piece,
// but there's no way to communicate this to the peer. If they