(trunk libT) more assertions to help find the cause of #2480

This commit is contained in:
Charles Kerr 2009-10-10 17:37:34 +00:00
parent 9d84a36df3
commit 0fd817b757
2 changed files with 11 additions and 2 deletions

View File

@ -1026,6 +1026,8 @@ canRead( struct tr_peerIo * io, void * arg, size_t * piece )
ReadState ret;
tr_bool readyForMore = TRUE;
assert( tr_isPeerIo( io ) );
/* no piece data in handshake */
*piece = 0;

View File

@ -115,14 +115,18 @@ didWriteWrapper( tr_peerIo * io, size_t bytes_transferred )
static void
canReadWrapper( tr_peerIo * io )
{
tr_bool done = 0;
tr_bool err = 0;
tr_session * session = io->session;
tr_bool done = 0;
tr_session * session;
dbgmsg( io, "canRead" );
assert( tr_isPeerIo( io ) );
assert( tr_isSession( io->session ) );
tr_peerIoRef( io );
session = io->session;
/* try to consume the input buffer */
if( io->canRead )
{
@ -160,6 +164,8 @@ canReadWrapper( tr_peerIo * io )
err = 1;
break;
}
assert( tr_isPeerIo( io ) );
}
tr_globalUnlock( session );
@ -171,6 +177,7 @@ canReadWrapper( tr_peerIo * io )
io->inbuf = evbuffer_new( );
}
assert( tr_isPeerIo( io ) );
tr_peerIoUnref( io );
}