Changeset 4036


Ignore:
Timestamp:
Dec 1, 2007, 11:08:34 PM (15 years ago)
Author:
charles
Message:

improve upload speeds when the speed limits are uncapped.

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/handshake.c

    r3846 r4036  
    969969{
    970970    dbgmsg( handshake, "handshakeDone: %s", isOK ? "connected" : "aborting" );
    971     tr_peerIoSetIOFuncs( handshake->io, NULL, NULL, NULL );
     971    tr_peerIoSetIOFuncs( handshake->io, NULL, NULL, NULL, NULL );
    972972
    973973    fireDoneFunc( handshake, isOK );
     
    10311031    handshake->handle = tr_peerIoGetHandle( io );
    10321032   
    1033     tr_peerIoSetIOFuncs( handshake->io, canRead, gotError, handshake );
     1033    tr_peerIoSetIOFuncs( handshake->io, canRead, NULL, gotError, handshake );
    10341034
    10351035    if( tr_peerIoIsIncoming( handshake->io ) )
  • trunk/libtransmission/peer-io.c

    r3879 r4036  
    6262
    6363    tr_can_read_cb     canRead;
     64    tr_did_write_cb    didWrite;
    6465    tr_net_error_cb    gotError;
    6566    void             * userData;
     
    7172***
    7273**/
     74
     75static void
     76didWriteWrapper( struct bufferevent * e, void * userData )
     77{
     78    tr_peerIo * c = (tr_peerIo *) userData;
     79    if( c->didWrite != NULL )
     80        (*c->didWrite)( e, c->userData );
     81}
    7382
    7483static void
     
    135144    c->bufev = bufferevent_new( c->socket,
    136145                                canReadWrapper,
    137                                 NULL,
     146                                didWriteWrapper,
    138147                                gotErrorWrapper,
    139148                                c );
     
    193202    {
    194203        io->canRead = NULL;
     204        io->didWrite = NULL;
    195205        io->gotError = NULL;
    196206        tr_runInEventThread( io->handle, io_dtor, io );
     
    242252tr_peerIoSetIOFuncs( tr_peerIo          * io,
    243253                     tr_can_read_cb       readcb,
     254                     tr_did_write_cb      writecb,
    244255                     tr_net_error_cb      errcb,
    245256                     void               * userData )
    246257{
    247258    io->canRead = readcb;
     259    io->didWrite = writecb;
    248260    io->gotError = errcb;
    249261    io->userData = userData;
     
    273285
    274286        io->bufev = bufferevent_new( io->socket,
    275                                      canReadWrapper, NULL, gotErrorWrapper,
     287                                     canReadWrapper,
     288                                     didWriteWrapper,
     289                                     gotErrorWrapper,
    276290                                     io );
    277291        bufferevent_settimeout( io->bufev, io->timeout, io->timeout );
  • trunk/libtransmission/peer-io.h

    r3882 r4036  
    100100typedef enum { READ_MORE, READ_AGAIN, READ_DONE } ReadState;
    101101typedef ReadState (*tr_can_read_cb)(struct bufferevent*, void* user_data);
     102typedef void (*tr_did_write_cb)(struct bufferevent *, void *);
    102103typedef void (*tr_net_error_cb)(struct bufferevent *, short what, void *);
    103104
    104105void  tr_peerIoSetIOFuncs( tr_peerIo        * io,
    105106                           tr_can_read_cb     readcb,
     107                           tr_did_write_cb    writecb,
    106108                           tr_net_error_cb    errcb,
    107109                           void             * user_data );
  • trunk/libtransmission/peer-msgs.c

    r4002 r4036  
    14111411}
    14121412
     1413static void
     1414didWrite( struct bufferevent * evin UNUSED, void * vmsgs )
     1415{
     1416    pulse( vmsgs );
     1417}
     1418
    14131419static ReadState
    14141420canRead( struct bufferevent * evin, void * vmsgs )
     
    18441850   
    18451851    tr_peerIoSetTimeoutSecs( m->io, 150 ); /* timeout after N seconds of inactivity */
    1846     tr_peerIoSetIOFuncs( m->io, canRead, gotError, m );
     1852    tr_peerIoSetIOFuncs( m->io, canRead, didWrite, gotError, m );
    18471853    ratePulse( m );
    18481854
Note: See TracChangeset for help on using the changeset viewer.