Changeset 7645


Ignore:
Timestamp:
Jan 8, 2009, 8:35:10 PM (12 years ago)
Author:
charles
Message:

(trunk libT) clear out the experimental code that accumulated while trying to find the fix to the tracker-announces-never-finish bug. This revision is 1.42's version plus bugfixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/web.c

    r7557 r7645  
    2525#include "web.h"
    2626
    27 enum
     27enum 
    2828{
    2929    /* arbitrary number */
    30     MAX_CONCURRENT_TASKS = 100,
     30    MAX_CONCURRENT_TASKS = 24,
    3131
    3232    /* arbitrary number */
    33     DEFAULT_TIMER_MSEC = 2500
     33    DEFAULT_TIMER_MSEC = 2000
    3434};
    3535
     
    5050struct tr_web
    5151{
    52     tr_bool closing;
     52    tr_bool isClosing;
    5353    int prev_running;
    5454    int still_running;
     
    5656    CURLM * multi;
    5757    tr_session * session;
    58 #if 0
    5958    tr_list * easy_queue;
    60 #endif
    6159    struct event timer_event;
    6260};
     
    126124        }
    127125
    128         curl_easy_setopt( easy, CURLOPT_DNS_CACHE_TIMEOUT, 3600L );
    129         curl_easy_setopt( easy, CURLOPT_CONNECTTIMEOUT, 120L );
     126        curl_easy_setopt( easy, CURLOPT_DNS_CACHE_TIMEOUT, 360L );
     127        curl_easy_setopt( easy, CURLOPT_CONNECTTIMEOUT, 60L );
    130128        curl_easy_setopt( easy, CURLOPT_FOLLOWLOCATION, 1L );
     129        curl_easy_setopt( easy, CURLOPT_MAXREDIRS, 16L );
    131130        curl_easy_setopt( easy, CURLOPT_NOSIGNAL, 1L );
    132131        curl_easy_setopt( easy, CURLOPT_PRIVATE, task );
     
    145144            curl_easy_setopt( easy, CURLOPT_ENCODING, "" );
    146145
    147 #if 0
    148         if( web->still_running >= MAX_CONCURRENT_TASKS )
    149         {
     146        if( web->still_running >= MAX_CONCURRENT_TASKS ) {
    150147            tr_list_append( &web->easy_queue, easy );
    151148            dbgmsg( " >> enqueueing a task ... size is now %d",
    152149                                           tr_list_size( web->easy_queue ) );
    153         }
    154         else
    155 #endif
    156         {
     150        } else {
    157151            const CURLMcode rc = curl_multi_add_handle( web->multi, easy );
    158152            if( rc == CURLM_OK )
     
    215209            curl_easy_getinfo( easy, CURLINFO_PRIVATE, (void*)&task );
    216210            curl_easy_getinfo( easy, CURLINFO_RESPONSE_CODE, &code );
    217             task_finish( task, code );
    218211            curl_multi_remove_handle( g->multi, easy );
    219212            curl_easy_cleanup( easy );
     213            task_finish( task, code );
    220214        }
    221215    }
     
    244238}
    245239
    246 #if 0
    247240static void
    248241add_tasks_from_queue( tr_web * g )
     
    265258    }
    266259}
    267 #endif
    268260
    269261static void
     
    275267}
    276268
    277 /* note: this function can free the tr_web if its 'closing' flag is set
     269/* note: this function can free the tr_web if its 'isClosing' flag is set
    278270   and no tasks remain.  callers must not reference their g pointer
    279271   after calling this function */
     
    298290    remove_finished_tasks( g );
    299291
    300 #if 0
    301292    add_tasks_from_queue( g );
    302 #endif
    303293
    304294    if( !g->still_running ) {
    305295        stop_timer( g );
    306         if( g->closing ) {
     296        if( g->isClosing ) {
    307297            web_close( g );
    308298            closed = TRUE;
     
    477467        web_close( web );
    478468    else
    479         web->closing = 1;
     469        web->isClosing = 1;
    480470}
    481471
Note: See TracChangeset for help on using the changeset viewer.