Changeset 7828


Ignore:
Timestamp:
Feb 5, 2009, 2:52:00 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #1748: judging from Biiaru's testing yesterday after I left, the problem is somewhere in web.c. Let's start by adding some cruel assertions in there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/web.c

    r7811 r7828  
    159159#endif
    160160        {
    161             const CURLMcode rc = curl_multi_add_handle( web->multi, easy );
    162             if( rc == CURLM_OK )
     161            const CURLMcode mcode = curl_multi_add_handle( web->multi, easy );
     162            tr_assert( mcode == CURLM_OK, "curl_multi_add_handle() failed: %d (%s)", mcode, curl_multi_strerror( mcode ) );
     163            if( mcode == CURLM_OK )
    163164                ++web->still_running;
    164165            else
    165                 tr_err( "%s", curl_multi_strerror( rc ) );
     166                tr_err( "%s", curl_multi_strerror( mcode ) );
    166167        }
    167168    }
     
    221222            long code;
    222223            struct tr_web_task * task;
    223             curl_easy_getinfo( easy, CURLINFO_PRIVATE, (void*)&task );
    224             curl_easy_getinfo( easy, CURLINFO_RESPONSE_CODE, &code );
    225             curl_multi_remove_handle( g->multi, easy );
     224            CURLcode ecode;
     225            CURLMcode mcode;
     226            ecode = curl_easy_getinfo( easy, CURLINFO_PRIVATE, (void*)&task );
     227            tr_assert( ecode == CURLE_OK, "curl_easy_getinfo() failed: %d (%s)", ecode, curl_easy_strerror( ecode ) );
     228            ecode = curl_easy_getinfo( easy, CURLINFO_RESPONSE_CODE, &code );
     229            tr_assert( ecode == CURLE_OK, "curl_easy_getinfo() failed: %d (%s)", ecode, curl_easy_strerror( ecode ) );
     230            mcode = curl_multi_remove_handle( g->multi, easy );
     231            tr_assert( mcode == CURLM_OK, "curl_multi_socket_action() failed: %d (%s)", mcode, curl_multi_strerror( mcode ) );
    226232            curl_easy_cleanup( easy );
    227233            task_finish( task, code );
     
    284290web_close( tr_web * g )
    285291{
     292    CURLMcode mcode;
     293
    286294    stop_timer( g );
    287     curl_multi_cleanup( g->multi );
     295
     296    mcode = curl_multi_cleanup( g->multi );
     297    tr_assert( mcode == CURLM_OK, "curl_multi_cleanup() failed: %d (%s)", mcode, curl_multi_strerror( mcode ) );
     298    if( mcode != CURLM_OK )
     299        tr_err( "%s", curl_multi_strerror( mcode ) );
     300
    288301    tr_free( g );
    289302}
     
    296309{
    297310    int closed = FALSE;
    298     CURLMcode rc;
     311    CURLMcode mcode;
    299312
    300313    dbgmsg( "check_run_count: prev_running %d, still_running %d",
     
    303316    /* invoke libcurl's processing */
    304317    do {
    305         rc = curl_multi_socket_action( g->multi, fd, 0, &g->still_running );
    306         dbgmsg( "event_cb(): fd %d, still_running is %d",
    307                 fd, g->still_running );
    308     } while( rc == CURLM_CALL_MULTI_PERFORM );
    309     if( rc != CURLM_OK )
    310         tr_err( "%s", curl_multi_strerror( rc ) );
     318        mcode = curl_multi_socket_action( g->multi, fd, 0, &g->still_running );
     319        dbgmsg( "event_cb(): fd %d, still_running is %d", fd, g->still_running );
     320    } while( mcode == CURLM_CALL_MULTI_PERFORM );
     321    tr_assert( mcode == CURLM_OK, "curl_multi_socket_action() failed: %d (%s)", mcode, curl_multi_strerror( mcode ) );
     322    if( mcode != CURLM_OK )
     323        tr_err( "%s", curl_multi_strerror( mcode ) );
    311324
    312325    remove_finished_tasks( g );
     
    382395         struct tr_web  * g )
    383396{
    384     struct tr_web_sockinfo * f = tr_new0( struct tr_web_sockinfo, 1 );
     397    CURLMcode mcode;
     398    struct tr_web_sockinfo * f;
     399
     400    f = tr_new0( struct tr_web_sockinfo, 1 );
    385401    dbgmsg( "creating a sockinfo %p for fd %d", f, sockfd );
    386402    setsock( sockfd, action, g, f );
    387     curl_multi_assign( g->multi, sockfd, f );
     403
     404    mcode = curl_multi_assign( g->multi, sockfd, f );
     405    tr_assert( mcode == CURLM_OK, "curl_multi_assign() failed: %d (%s)", mcode, curl_multi_strerror( mcode ) );
     406    if( mcode != CURLM_OK )
     407        tr_err( "%s", curl_multi_strerror( mcode ) );
    388408}
    389409
     
    462482tr_webInit( tr_session * session )
    463483{
     484    CURLMcode mcode;
    464485    static int curlInited = FALSE;
    465486    tr_web * web;
     
    480501
    481502    evtimer_set( &web->timer_event, timer_cb, web );
    482     curl_multi_setopt( web->multi, CURLMOPT_SOCKETDATA, web );
    483     curl_multi_setopt( web->multi, CURLMOPT_SOCKETFUNCTION, sock_cb );
    484     curl_multi_setopt( web->multi, CURLMOPT_TIMERDATA, web );
    485     curl_multi_setopt( web->multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb );
     503    mcode = curl_multi_setopt( web->multi, CURLMOPT_SOCKETDATA, web );
     504    tr_assert( mcode == CURLM_OK, "curl_mutli_setopt() failed: %d (%s)", mcode, curl_multi_strerror( mcode ) );
     505    mcode = curl_multi_setopt( web->multi, CURLMOPT_SOCKETFUNCTION, sock_cb );
     506    tr_assert( mcode == CURLM_OK, "curl_mutli_setopt() failed: %d (%s)", mcode, curl_multi_strerror( mcode ) );
     507    mcode = curl_multi_setopt( web->multi, CURLMOPT_TIMERDATA, web );
     508    tr_assert( mcode == CURLM_OK, "curl_mutli_setopt() failed: %d (%s)", mcode, curl_multi_strerror( mcode ) );
     509    mcode = curl_multi_setopt( web->multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb );
     510    tr_assert( mcode == CURLM_OK, "curl_mutli_setopt() failed: %d (%s)", mcode, curl_multi_strerror( mcode ) );
    486511
    487512    return web;
Note: See TracChangeset for help on using the changeset viewer.