Changeset 7790


Ignore:
Timestamp:
Jan 24, 2009, 2:49:35 PM (12 years ago)
Author:
charles
Message:

(trunk libT) experimental commit that will *possibly* fix the "assert( tr_isPeerIo( io ) )" crash reported by Biiaru and others

Location:
trunk/libtransmission
Files:
2 edited

Legend:

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

    r7789 r7790  
    192192
    193193    io->hasFinishedConnecting = TRUE;
     194    io->pendingEvents &= ~EV_READ;
    194195
    195196    curlen = EVBUFFER_LENGTH( io->inbuf );
     
    274275
    275276    io->hasFinishedConnecting = TRUE;
     277    io->pendingEvents &= ~EV_WRITE;
    276278
    277279    dbgmsg( io, "libevent says this peer is ready to write" );
     
    835837event_enable( tr_peerIo * io, short event )
    836838{
    837     if( event & EV_READ ) {
     839    assert( event_initialized( &io->event_read ) );
     840    assert( event_initialized( &io->event_write ) );
     841
     842    if( ( event & EV_READ ) && ! ( io->pendingEvents & EV_READ ) )
     843    {
    838844        dbgmsg( io, "enabling libevent ready-to-read polling" );
    839845        event_add( &io->event_read, NULL );
    840     }
    841 
    842     if( event & EV_WRITE ) {
     846        io->pendingEvents |= EV_READ;
     847    }
     848
     849    if( ( event & EV_WRITE ) && ! ( io->pendingEvents & EV_WRITE ) )
     850    {
    843851        dbgmsg( io, "enabling libevent ready-to-write polling" );
    844852        event_add( &io->event_write, NULL );
     853        io->pendingEvents |= EV_WRITE;
    845854    }
    846855}
     
    849858event_disable( struct tr_peerIo * io, short event )
    850859{
    851     if( event & EV_READ ) {
     860    assert( event_initialized( &io->event_read ) );
     861    assert( event_initialized( &io->event_write ) );
     862
     863    if( ( event & EV_READ ) && ( io->pendingEvents & EV_READ ) )
     864    {
    852865        dbgmsg( io, "disabling libevent ready-to-read polling" );
    853866        event_del( &io->event_read );
    854     }
    855 
    856     if( event & EV_WRITE ) {
     867        io->pendingEvents &= ~EV_READ;
     868    }
     869
     870    if( ( event & EV_WRITE ) && ( io->pendingEvents & EV_WRITE ) )
     871    {
    857872        dbgmsg( io, "disabling libevent ready-to-write polling" );
    858873        event_del( &io->event_write );
     874        io->pendingEvents &= ~EV_WRITE;
    859875    }
    860876}
  • trunk/libtransmission/peer-io.h

    r7789 r7790  
    7070    tr_bool               hasFinishedConnecting;
    7171
     72    int                   pendingEvents;
     73
    7274    int                   magicNumber;
    7375
Note: See TracChangeset for help on using the changeset viewer.