1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 17:17:31 +00:00

(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.

This commit is contained in:
Charles Kerr 2009-01-08 20:35:10 +00:00
parent e7b9a2eaa2
commit f7db63329d

View file

@ -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;
}
/*****