Changeset 7622


Ignore:
Timestamp:
Jan 5, 2009, 6:20:47 PM (12 years ago)
Author:
charles
Message:

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

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-io.c

    r7618 r7622  
    192192    const tr_direction dir = TR_DOWN;
    193193    const size_t max = 256 * 1024;
    194     const size_t curlen = EVBUFFER_LENGTH( io->inbuf );
    195 
     194    size_t curlen;
     195
     196    assert( tr_isPeerIo( io ) );
     197
     198    curlen = EVBUFFER_LENGTH( io->inbuf );
    196199    howmuch = curlen >= max ? 0 : max - curlen;
    197200    howmuch = tr_bandwidthClamp( &io->bandwidth, TR_DOWN, howmuch );
    198 
    199     assert( tr_isPeerIo( io ) );
    200201
    201202    dbgmsg( io, "libevent says this peer is ready to read" );
     
    497498}
    498499
     500void
     501tr_peerIoClear( tr_peerIo * io )
     502{
     503    tr_peerIoSetIOFuncs( io, NULL, NULL, NULL, NULL );
     504    tr_peerIoSetEnabled( io, TR_UP, FALSE );
     505    tr_peerIoSetEnabled( io, TR_DOWN, FALSE );
     506}
     507
    499508int
    500509tr_peerIoReconnect( tr_peerIo * io )
  • trunk/libtransmission/peer-io.h

    r7618 r7622  
    211211                                   void             * user_data );
    212212
     213void    tr_peerIoClear           ( tr_peerIo        * io );
     214
    213215/**
    214216***
  • trunk/libtransmission/peer-mgr.c

    r7620 r7622  
    356356    }
    357357
    358     tr_peerIoSetIOFuncs( peer->io, NULL, NULL, NULL, NULL );
     358    tr_peerIoClear( peer->io );
    359359    tr_peerIoUnref( peer->io ); /* balanced by the ref in handshakeDoneCB() */
    360360
  • trunk/libtransmission/request-list.c

    r7616 r7622  
    107107reqListRemoveNthFromFifo( struct request_list * list, int n )
    108108{
    109     memmove( &list->fifo[n], &list->fifo[n+1], (list->len-1)*sizeof(struct peer_request));
     109    memmove( &list->fifo[n], &list->fifo[n+1], (list->len-n-1)*sizeof(struct peer_request));
    110110}
    111111
Note: See TracChangeset for help on using the changeset viewer.