From 5563729d61e40f84299a18fec524ebc3bd58a2de Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Fri, 18 Feb 2011 00:24:15 +0000 Subject: [PATCH] Add assertions to libevent callbacks. They should never be called with a UTP socket. --- libtransmission/peer-io.c | 2 ++ 1 file changed, 2 insertions(+) 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;