(trunk libT) minor cleanup

This commit is contained in:
Charles Kerr 2009-01-17 22:49:15 +00:00
parent c512ca3f91
commit 4f95edf647
1 changed files with 19 additions and 13 deletions

View File

@ -125,10 +125,11 @@ 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_FORBID_REUSE, 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 );
@ -199,27 +200,32 @@ task_finish( struct tr_web_task * task, long response_code )
static void
remove_finished_tasks( tr_web * g )
{
for( ;; )
{
int ignored;
CURLMsg * msg = curl_multi_info_read( g->multi, &ignored );
CURL * easy;
if( msg == NULL )
{
break;
do
{
CURLMsg * msg;
int msgs_left;
easy = NULL;
while(( msg = curl_multi_info_read( g->multi, &msgs_left ))) {
if( msg->msg == CURLMSG_DONE ) {
easy = msg->easy_handle;
break;
}
}
else if( ( msg->msg == CURLMSG_DONE ) && ( msg->easy_handle != NULL ) )
{
CURL * easy = msg->easy_handle;
if( easy ) {
long code;
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 );
}
}
while ( easy );
g->prev_running = g->still_running;
}