]> granicus.if.org Git - transmission/commitdiff
Add assertions to libevent callbacks.
authorJuliusz Chroboczek <jch@pps.univ-paris-diderot.fr>
Fri, 18 Feb 2011 00:24:15 +0000 (00:24 +0000)
committerJuliusz Chroboczek <jch@pps.univ-paris-diderot.fr>
Fri, 18 Feb 2011 00:24:15 +0000 (00:24 +0000)
They should never be called with a UTP socket.

libtransmission/peer-io.c

index 7b96f393d94bfa554791da22d27981da014db3ca..5c0cc440be5c13493df802be0401770030cf5c37 100644 (file)
@@ -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;