mirror of
https://github.com/transmission/transmission
synced 2024-12-26 17:47:37 +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:
parent
e7b9a2eaa2
commit
f7db63329d
1 changed files with 13 additions and 23 deletions
|
@ -27,10 +27,10 @@
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
/* arbitrary number */
|
/* arbitrary number */
|
||||||
MAX_CONCURRENT_TASKS = 100,
|
MAX_CONCURRENT_TASKS = 24,
|
||||||
|
|
||||||
/* arbitrary number */
|
/* arbitrary number */
|
||||||
DEFAULT_TIMER_MSEC = 2500
|
DEFAULT_TIMER_MSEC = 2000
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -49,15 +49,13 @@ enum
|
||||||
|
|
||||||
struct tr_web
|
struct tr_web
|
||||||
{
|
{
|
||||||
tr_bool closing;
|
tr_bool isClosing;
|
||||||
int prev_running;
|
int prev_running;
|
||||||
int still_running;
|
int still_running;
|
||||||
long timer_ms;
|
long timer_ms;
|
||||||
CURLM * multi;
|
CURLM * multi;
|
||||||
tr_session * session;
|
tr_session * session;
|
||||||
#if 0
|
|
||||||
tr_list * easy_queue;
|
tr_list * easy_queue;
|
||||||
#endif
|
|
||||||
struct event timer_event;
|
struct event timer_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -125,9 +123,10 @@ addTask( void * vtask )
|
||||||
tr_free( str );
|
tr_free( str );
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_easy_setopt( easy, CURLOPT_DNS_CACHE_TIMEOUT, 3600L );
|
curl_easy_setopt( easy, CURLOPT_DNS_CACHE_TIMEOUT, 360L );
|
||||||
curl_easy_setopt( easy, CURLOPT_CONNECTTIMEOUT, 120L );
|
curl_easy_setopt( easy, CURLOPT_CONNECTTIMEOUT, 60L );
|
||||||
curl_easy_setopt( easy, CURLOPT_FOLLOWLOCATION, 1L );
|
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_NOSIGNAL, 1L );
|
||||||
curl_easy_setopt( easy, CURLOPT_PRIVATE, task );
|
curl_easy_setopt( easy, CURLOPT_PRIVATE, task );
|
||||||
curl_easy_setopt( easy, CURLOPT_SSL_VERIFYHOST, 0L );
|
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 */
|
else /* don't set encoding on webseeds; it messes up binary data */
|
||||||
curl_easy_setopt( easy, CURLOPT_ENCODING, "" );
|
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 );
|
tr_list_append( &web->easy_queue, easy );
|
||||||
dbgmsg( " >> enqueueing a task ... size is now %d",
|
dbgmsg( " >> enqueueing a task ... size is now %d",
|
||||||
tr_list_size( web->easy_queue ) );
|
tr_list_size( web->easy_queue ) );
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
const CURLMcode rc = curl_multi_add_handle( web->multi, easy );
|
const CURLMcode rc = curl_multi_add_handle( web->multi, easy );
|
||||||
if( rc == CURLM_OK )
|
if( rc == CURLM_OK )
|
||||||
++web->still_running;
|
++web->still_running;
|
||||||
|
@ -214,9 +208,9 @@ remove_finished_tasks( tr_web * g )
|
||||||
struct tr_web_task * task;
|
struct tr_web_task * task;
|
||||||
curl_easy_getinfo( easy, CURLINFO_PRIVATE, (void*)&task );
|
curl_easy_getinfo( easy, CURLINFO_PRIVATE, (void*)&task );
|
||||||
curl_easy_getinfo( easy, CURLINFO_RESPONSE_CODE, &code );
|
curl_easy_getinfo( easy, CURLINFO_RESPONSE_CODE, &code );
|
||||||
task_finish( task, code );
|
|
||||||
curl_multi_remove_handle( g->multi, easy );
|
curl_multi_remove_handle( g->multi, easy );
|
||||||
curl_easy_cleanup( easy );
|
curl_easy_cleanup( easy );
|
||||||
|
task_finish( task, code );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +237,6 @@ restart_timer( tr_web * g )
|
||||||
evtimer_add( &g->timer_event, &interval );
|
evtimer_add( &g->timer_event, &interval );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
static void
|
||||||
add_tasks_from_queue( tr_web * g )
|
add_tasks_from_queue( tr_web * g )
|
||||||
{
|
{
|
||||||
|
@ -264,7 +257,6 @@ add_tasks_from_queue( tr_web * g )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
web_close( tr_web * g )
|
web_close( tr_web * g )
|
||||||
|
@ -274,7 +266,7 @@ web_close( tr_web * g )
|
||||||
tr_free( 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
|
and no tasks remain. callers must not reference their g pointer
|
||||||
after calling this function */
|
after calling this function */
|
||||||
static void
|
static void
|
||||||
|
@ -297,13 +289,11 @@ tr_multi_socket_action( tr_web * g, int fd )
|
||||||
|
|
||||||
remove_finished_tasks( g );
|
remove_finished_tasks( g );
|
||||||
|
|
||||||
#if 0
|
|
||||||
add_tasks_from_queue( g );
|
add_tasks_from_queue( g );
|
||||||
#endif
|
|
||||||
|
|
||||||
if( !g->still_running ) {
|
if( !g->still_running ) {
|
||||||
stop_timer( g );
|
stop_timer( g );
|
||||||
if( g->closing ) {
|
if( g->isClosing ) {
|
||||||
web_close( g );
|
web_close( g );
|
||||||
closed = TRUE;
|
closed = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -476,7 +466,7 @@ tr_webClose( tr_web ** web_in )
|
||||||
if( web->still_running < 1 )
|
if( web->still_running < 1 )
|
||||||
web_close( web );
|
web_close( web );
|
||||||
else
|
else
|
||||||
web->closing = 1;
|
web->isClosing = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
|
|
Loading…
Reference in a new issue