Ignore:
Timestamp:
Oct 2, 2007, 2:59:07 AM (15 years ago)
Author:
charles
Message:

threads. gotta love 'em.

File:
1 edited

Legend:

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

    r3260 r3267  
    7676canReadWrapper( struct bufferevent * e, void * userData )
    7777{
     78    int done = 0;
    7879    tr_peerIo * c = (tr_peerIo *) userData;
     80    tr_handle * handle = c->handle;
    7981
    8082    if( c->canRead == NULL )
    8183        return;
    8284
    83     for( ;; ) {
     85    tr_globalLock( handle );
     86
     87    while( !done )
     88    {
    8489        const int ret = (*c->canRead)( e, c->userData );
    85         switch( ret ) {
    86             case READ_AGAIN: if( EVBUFFER_LENGTH( e->input ) ) continue; /* note fall-through */
    87             case READ_MORE: tr_peerIoSetIOMode( c, EV_READ, 0 ); return; break;
    88             case READ_DONE: return;
     90
     91        switch( ret )
     92        {
     93            case READ_AGAIN:
     94                if( EVBUFFER_LENGTH( e->input ) )
     95                    continue;
     96            case READ_MORE:
     97                tr_peerIoSetIOMode( c, EV_READ, 0 );
     98            case READ_DONE:
     99                done = 1;
    89100        }
    90101    }
     102
     103    tr_globalUnlock( handle );
    91104}
    92105
Note: See TracChangeset for help on using the changeset viewer.