]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Ignore the corner case when a piece is dropped from storage
authorMatt Joiner <anacrolix@gmail.com>
Fri, 26 Feb 2016 11:12:13 +0000 (22:12 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 26 Feb 2016 11:12:13 +0000 (22:12 +1100)
client.go

index 3a15bb3ab3b8977cfb0e0e2b3d3a20883ba13ef6..f60a4607458bbb6a8c139ddeedffc42922b36e8e 100644 (file)
--- a/client.go
+++ b/client.go
@@ -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