1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

(trunk libT) peer-mgr.c peerCallbackFunc(): Replace some "should always be true" tests with assert()s. These tests used to be useful, but I don't think they are anymore. The assert()s have been put in their place to test that theory...

This commit is contained in:
Jordan Lee 2011-02-25 01:48:46 +00:00
parent 3136946851
commit cff172bbd5

View file

@ -1607,6 +1607,9 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt )
torrentLock( t );
assert( peer != NULL );
assert( peer->atom != NULL );
switch( e->eventType )
{
case TR_PEER_PEER_GOT_DATA:
@ -1627,7 +1630,7 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt )
tr_statsAddUploaded( tor->session, e->length );
/* update our atom */
if( peer && e->wasPieceData )
if( e->wasPieceData )
peer->atom->piece_data_time = now;
break;
@ -1668,18 +1671,15 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt )
break;
case TR_PEER_CLIENT_GOT_PORT:
if( peer )
peer->atom->port = e->port;
peer->atom->port = e->port;
break;
case TR_PEER_CLIENT_GOT_SUGGEST:
if( peer )
peerSuggestedPiece( t, peer, e->pieceIndex, FALSE );
peerSuggestedPiece( t, peer, e->pieceIndex, FALSE );
break;
case TR_PEER_CLIENT_GOT_ALLOWED_FAST:
if( peer )
peerSuggestedPiece( t, peer, e->pieceIndex, TRUE );
peerSuggestedPiece( t, peer, e->pieceIndex, TRUE );
break;
case TR_PEER_CLIENT_GOT_DATA:
@ -1699,7 +1699,7 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt )
tr_statsAddDownloaded( tor->session, e->length );
/* update our atom */
if( peer && peer->atom && e->wasPieceData )
if( e->wasPieceData )
peer->atom->piece_data_time = now;
break;
@ -1730,8 +1730,7 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt )
tr_ptrArrayDestruct( &peerArr, FALSE );
if( peer )
tr_historyAdd( &peer->blocksSentToClient, tr_time( ), 1 );
tr_historyAdd( &peer->blocksSentToClient, tr_time( ), 1 );
if( tr_cpBlockIsComplete( &tor->completion, block ) )
{