Changeset 9760


Ignore:
Timestamp:
Dec 14, 2009, 6:24:26 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #2416 "crash in event_queue_insert" -- another stab at fixing this. yay

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/web.c

    r9756 r9760  
    239239
    240240static void
    241 tr_multi_perform( tr_web * g, int fd )
     241tr_multi_perform( tr_web * g, int fd, int curl_what )
    242242{
    243243    CURLMcode mcode;
     
    247247    /* invoke libcurl's processing */
    248248    do
    249         mcode = curl_multi_socket_action( g->multi, fd, 0, &g->taskCount );
     249        mcode = curl_multi_socket_action( g->multi, fd, curl_what, &g->taskCount );
    250250    while( mcode == CURLM_CALL_MULTI_SOCKET );
    251251
     
    260260/* libevent says that sock is ready to be processed, so wake up libcurl */
    261261static void
    262 event_cb( int fd, short kind UNUSED, void * g )
    263 {
    264     tr_multi_perform( g, fd );
     262event_cb( int fd, short ev_what, void * g )
     263{
     264    int curl_what = 0;
     265    if( ev_what & EV_READ ) curl_what |= CURL_POLL_IN;
     266    if( ev_what & EV_WRITE ) curl_what |= CURL_POLL_OUT;
     267    tr_multi_perform( g, fd, curl_what );
    265268}
    266269
     
    275278    dbgmsg( "sock_cb: action %d, fd %d, io_event %p", action, (int)fd, io_event );
    276279
    277     if( action == CURL_POLL_REMOVE )
     280    if( ( action == CURL_POLL_NONE ) || ( action & CURL_POLL_REMOVE ) )
    278281    {
    279282        if( io_event != NULL )
     
    285288        }
    286289    }
    287     else if( action & ( EV_READ | EV_WRITE ) )
     290    else if( action & ( CURL_POLL_IN | CURL_POLL_OUT ) )
    288291    {
    289292        const short events = EV_PERSIST
     
    304307        event_add( io_event, NULL );
    305308    }
     309    else tr_assert( 0, "unhandled action: %d", action );
    306310
    307311    return 0; /* libcurl documentation: "The callback MUST return 0." */
     
    313317{
    314318    dbgmsg( "libevent timer is done" );
    315     tr_multi_perform( g, CURL_SOCKET_TIMEOUT );
     319    tr_multi_perform( g, CURL_SOCKET_TIMEOUT, 0 );
    316320}
    317321
     
    328332
    329333    if( timer_msec < 1 )
    330         tr_multi_perform( g, CURL_SOCKET_TIMEOUT );
     334        tr_multi_perform( g, CURL_SOCKET_TIMEOUT, 0 );
    331335}
    332336
Note: See TracChangeset for help on using the changeset viewer.