diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index f740d0127..6d1f1e06b 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -346,6 +346,10 @@ tr_peerIoNew( tr_session * session, { tr_peerIo * io; + assert( session != NULL ); + assert( session->events != NULL ); + assert( tr_amInEventThread( session ) ); + if( socket >= 0 ) tr_netSetTOS( socket, session->peerSocketTOS ); @@ -848,6 +852,7 @@ static void event_enable( tr_peerIo * io, short event ) { assert( tr_amInEventThread( io->session ) ); + assert( io->session != NULL ); assert( io->session->events != NULL ); assert( event_initialized( &io->event_read ) ); assert( event_initialized( &io->event_write ) ); @@ -871,6 +876,7 @@ static void event_disable( struct tr_peerIo * io, short event ) { assert( tr_amInEventThread( io->session ) ); + assert( io->session != NULL ); assert( io->session->events != NULL ); assert( event_initialized( &io->event_read ) ); assert( event_initialized( &io->event_write ) ); diff --git a/libtransmission/trevent.c b/libtransmission/trevent.c index 2ed25d831..3821c3445 100644 --- a/libtransmission/trevent.c +++ b/libtransmission/trevent.c @@ -346,8 +346,8 @@ tr_timerNew( tr_session * session, { tr_timer * timer; - assert( session ); - assert( session->events ); + assert( session != NULL ); + assert( session->events != NULL ); timer = tr_new0( tr_timer, 1 ); tr_timevalMsec( interval_milliseconds, &timer->tv ); @@ -379,8 +379,8 @@ void tr_runInEventThread( tr_session * session, void func( void* ), void * user_data ) { - assert( session ); - assert( session->events ); + assert( session != NULL ); + assert( session->events != NULL ); if( tr_amInThread( session->events->thread ) ) { diff --git a/libtransmission/web.c b/libtransmission/web.c index 622887601..cd4856987 100644 --- a/libtransmission/web.c +++ b/libtransmission/web.c @@ -246,6 +246,11 @@ static void restart_timer( tr_web * g ) { struct timeval interval; + + assert( tr_amInEventThread( g->session ) ); + assert( g->session != NULL ); + assert( g->session->events != NULL ); + stop_timer( g ); dbgmsg( "adding a timeout for %ld seconds from now", g->timer_ms/1000L ); tr_timevalMsec( g->timer_ms, &interval ); @@ -357,6 +362,11 @@ setsock( curl_socket_t sockfd, const int kind = EV_PERSIST | (( action & CURL_POLL_IN ) ? EV_READ : 0 ) | (( action & CURL_POLL_OUT ) ? EV_WRITE : 0 ); + + assert( tr_amInEventThread( g->session ) ); + assert( g->session != NULL ); + assert( g->session->events != NULL ); + dbgmsg( "setsock: fd is %d, curl action is %d, libevent action is %d", sockfd, action, kind ); if( f->evset )