From 88d4df169b19b628dfd00c3045b9bb641c1d86eb Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 25 Jul 2007 16:50:32 +0000 Subject: [PATCH] Follow Azureus' and uTorrent's lead in not counting corrupt pieces in our announce data, as it could give us a misleadingly bad share ratio . (Ticket #263) --- libtransmission/peerparse.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libtransmission/peerparse.h b/libtransmission/peerparse.h index f684a79c8..76189fffb 100644 --- a/libtransmission/peerparse.h +++ b/libtransmission/peerparse.h @@ -350,6 +350,13 @@ static int parsePiece( tr_torrent_t * tor, tr_peer_t * peer, /* Piece is complete, check it */ if( ( ret = tr_ioHash( tor->io, index ) ) ) { + /* Follow Azureus' and uTorrent's lead in not counting corrupt + pieces in our announce data, as it could give us a misleadingly + bad share ratio . (Ticket #263) */ + const int byteCount = tr_pieceSize( index ); + if( tor->downloadedCur >= byteCount ) + tor->downloadedCur -= byteCount; + return ret; } if( !tr_cpPieceIsComplete( tor->completion, index ) )