]> granicus.if.org Git - transmission/commitdiff
(trunk libT) #1242 "don't accept duplicate blocks during endgame" -- fixed in trunk...
authorCharles Kerr <charles@transmissionbt.com>
Sun, 7 Mar 2010 17:38:34 +0000 (17:38 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sun, 7 Mar 2010 17:38:34 +0000 (17:38 +0000)
libtransmission/peer-msgs.c

index d58fbebeab597966395a155b089cedc8ee8ebbda..dda585d25add68433628b17acc9064d20e668a52 100644 (file)
@@ -1603,13 +1603,16 @@ clientGotBlock( tr_peermsgs *               msgs,
         return EMSGSIZE;
     }
 
-    /* save the block */
     dbgmsg( msgs, "got block %u:%u->%u", req->index, req->offset, req->length );
 
     if( !tr_peerMgrDidPeerRequest( msgs->torrent, msgs->peer, block ) ) {
         dbgmsg( msgs, "we didn't ask for this message..." );
         return 0;
     }
+    if( tr_cpPieceIsComplete( &msgs->torrent->completion, req->index ) ) {
+        dbgmsg( msgs, "we did ask for this message, but the piece is already complete..." );
+        return 0;
+    }
 
     /**
     ***  Save the block