From: Juliusz Chroboczek Date: Fri, 18 Feb 2011 00:24:15 +0000 (+0000) Subject: Add assertions to libevent callbacks. X-Git-Tag: 2.30b1~345 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5563729d61e40f84299a18fec524ebc3bd58a2de;p=transmission Add assertions to libevent callbacks. They should never be called with a UTP socket. --- diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index 7b96f393d..5c0cc440b 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -218,6 +218,7 @@ event_read_cb( int fd, short event UNUSED, void * vio ) const unsigned int max = 256 * 1024; assert( tr_isPeerIo( io ) ); + assert( io->socket >= 0 ); io->pendingEvents &= ~EV_READ; @@ -293,6 +294,7 @@ event_write_cb( int fd, short event UNUSED, void * vio ) const tr_direction dir = TR_UP; assert( tr_isPeerIo( io ) ); + assert( io->socket >= 0 ); io->pendingEvents &= ~EV_WRITE;