(trunk libT) fix the new-code errors reported by ZogG and Rolcol and Spaham

This commit is contained in:
Charles Kerr
2009-01-05 18:20:47 +00:00
parent fd26f21400
commit 30a989f1df
4 changed files with 17 additions and 6 deletions
+13 -4
View File
@@ -191,13 +191,14 @@ event_read_cb( int fd, short event UNUSED, void * vio )
size_t howmuch;
const tr_direction dir = TR_DOWN;
const size_t max = 256 * 1024;
const size_t curlen = EVBUFFER_LENGTH( io->inbuf );
howmuch = curlen >= max ? 0 : max - curlen;
howmuch = tr_bandwidthClamp( &io->bandwidth, TR_DOWN, howmuch );
size_t curlen;
assert( tr_isPeerIo( io ) );
curlen = EVBUFFER_LENGTH( io->inbuf );
howmuch = curlen >= max ? 0 : max - curlen;
howmuch = tr_bandwidthClamp( &io->bandwidth, TR_DOWN, howmuch );
dbgmsg( io, "libevent says this peer is ready to read" );
/* if we don't have any bandwidth left, stop reading */
@@ -496,6 +497,14 @@ tr_peerIoSetIOFuncs( tr_peerIo * io,
io->userData = userData;
}
void
tr_peerIoClear( tr_peerIo * io )
{
tr_peerIoSetIOFuncs( io, NULL, NULL, NULL, NULL );
tr_peerIoSetEnabled( io, TR_UP, FALSE );
tr_peerIoSetEnabled( io, TR_DOWN, FALSE );
}
int
tr_peerIoReconnect( tr_peerIo * io )
{
+2
View File
@@ -210,6 +210,8 @@ void tr_peerIoSetIOFuncs ( tr_peerIo * io,
tr_net_error_cb errcb,
void * user_data );
void tr_peerIoClear ( tr_peerIo * io );
/**
***
**/
+1 -1
View File
@@ -355,7 +355,7 @@ peerDestructor( tr_peer * peer )
tr_peerMsgsFree( peer->msgs );
}
tr_peerIoSetIOFuncs( peer->io, NULL, NULL, NULL, NULL );
tr_peerIoClear( peer->io );
tr_peerIoUnref( peer->io ); /* balanced by the ref in handshakeDoneCB() */
tr_bitfieldFree( peer->have );
+1 -1
View File
@@ -106,7 +106,7 @@ reqListRemoveFromSorted( struct request_list * list, const struct peer_request *
static void
reqListRemoveNthFromFifo( struct request_list * list, int n )
{
memmove( &list->fifo[n], &list->fifo[n+1], (list->len-1)*sizeof(struct peer_request));
memmove( &list->fifo[n], &list->fifo[n+1], (list->len-n-1)*sizeof(struct peer_request));
}
tr_bool