From: Charles Kerr Date: Thu, 8 Jan 2009 20:35:10 +0000 (+0000) Subject: (trunk libT) clear out the experimental code that accumulated while trying to find... X-Git-Tag: 1.60~531 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7db63329d7d39a6f7b7624779d9cd344dfe7f1a;p=transmission (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. --- diff --git a/libtransmission/web.c b/libtransmission/web.c index d63667ee7..7ae7a43ed 100644 --- a/libtransmission/web.c +++ b/libtransmission/web.c @@ -24,13 +24,13 @@ #include "utils.h" #include "web.h" -enum +enum { /* arbitrary number */ - MAX_CONCURRENT_TASKS = 100, + MAX_CONCURRENT_TASKS = 24, /* arbitrary number */ - DEFAULT_TIMER_MSEC = 2500 + DEFAULT_TIMER_MSEC = 2000 }; #if 0 @@ -49,15 +49,13 @@ enum struct tr_web { - tr_bool closing; + tr_bool isClosing; int prev_running; int still_running; long timer_ms; CURLM * multi; tr_session * session; -#if 0 tr_list * easy_queue; -#endif struct event timer_event; }; @@ -125,9 +123,10 @@ addTask( void * vtask ) tr_free( str ); } - curl_easy_setopt( easy, CURLOPT_DNS_CACHE_TIMEOUT, 3600L ); - curl_easy_setopt( easy, CURLOPT_CONNECTTIMEOUT, 120L ); + curl_easy_setopt( easy, CURLOPT_DNS_CACHE_TIMEOUT, 360L ); + curl_easy_setopt( easy, CURLOPT_CONNECTTIMEOUT, 60L ); curl_easy_setopt( easy, CURLOPT_FOLLOWLOCATION, 1L ); + curl_easy_setopt( easy, CURLOPT_MAXREDIRS, 16L ); curl_easy_setopt( easy, CURLOPT_NOSIGNAL, 1L ); curl_easy_setopt( easy, CURLOPT_PRIVATE, task ); curl_easy_setopt( easy, CURLOPT_SSL_VERIFYHOST, 0L ); @@ -144,16 +143,11 @@ addTask( void * vtask ) else /* don't set encoding on webseeds; it messes up binary data */ curl_easy_setopt( easy, CURLOPT_ENCODING, "" ); -#if 0 - if( web->still_running >= MAX_CONCURRENT_TASKS ) - { + if( web->still_running >= MAX_CONCURRENT_TASKS ) { tr_list_append( &web->easy_queue, easy ); dbgmsg( " >> enqueueing a task ... size is now %d", tr_list_size( web->easy_queue ) ); - } - else -#endif - { + } else { const CURLMcode rc = curl_multi_add_handle( web->multi, easy ); if( rc == CURLM_OK ) ++web->still_running; @@ -214,9 +208,9 @@ remove_finished_tasks( tr_web * g ) struct tr_web_task * task; curl_easy_getinfo( easy, CURLINFO_PRIVATE, (void*)&task ); curl_easy_getinfo( easy, CURLINFO_RESPONSE_CODE, &code ); - task_finish( task, code ); curl_multi_remove_handle( g->multi, easy ); curl_easy_cleanup( easy ); + task_finish( task, code ); } } @@ -243,7 +237,6 @@ restart_timer( tr_web * g ) evtimer_add( &g->timer_event, &interval ); } -#if 0 static void add_tasks_from_queue( tr_web * g ) { @@ -264,7 +257,6 @@ add_tasks_from_queue( tr_web * g ) } } } -#endif static void web_close( tr_web * g ) @@ -274,7 +266,7 @@ web_close( tr_web * g ) tr_free( g ); } -/* note: this function can free the tr_web if its 'closing' flag is set +/* note: this function can free the tr_web if its 'isClosing' flag is set and no tasks remain. callers must not reference their g pointer after calling this function */ static void @@ -297,13 +289,11 @@ tr_multi_socket_action( tr_web * g, int fd ) remove_finished_tasks( g ); -#if 0 add_tasks_from_queue( g ); -#endif if( !g->still_running ) { stop_timer( g ); - if( g->closing ) { + if( g->isClosing ) { web_close( g ); closed = TRUE; } @@ -476,7 +466,7 @@ tr_webClose( tr_web ** web_in ) if( web->still_running < 1 ) web_close( web ); else - web->closing = 1; + web->isClosing = 1; } /*****