mirror of
https://github.com/transmission/transmission
synced 2024-12-27 10:07:40 +00:00
(trunk libT) simplify web.c's remove_finished_tasks() a bit
This commit is contained in:
parent
798bac0fcb
commit
eff510da18
1 changed files with 10 additions and 15 deletions
|
@ -200,32 +200,27 @@ task_finish( struct tr_web_task * task, long response_code )
|
||||||
static void
|
static void
|
||||||
remove_finished_tasks( tr_web * g )
|
remove_finished_tasks( tr_web * g )
|
||||||
{
|
{
|
||||||
CURL * easy;
|
for( ;; )
|
||||||
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
CURLMsg * msg;
|
int ignored;
|
||||||
int msgs_left;
|
CURLMsg * msg = curl_multi_info_read( g->multi, &ignored );
|
||||||
|
|
||||||
easy = NULL;
|
if( msg == NULL )
|
||||||
while(( msg = curl_multi_info_read( g->multi, &msgs_left ))) {
|
{
|
||||||
if( msg->msg == CURLMSG_DONE ) {
|
break;
|
||||||
easy = msg->easy_handle;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if( ( msg->msg == CURLMSG_DONE ) && ( msg->easy_handle != NULL ) )
|
||||||
if( easy ) {
|
{
|
||||||
|
CURL * easy = msg->easy_handle;
|
||||||
long code;
|
long code;
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( easy );
|
|
||||||
|
|
||||||
g->prev_running = g->still_running;
|
g->prev_running = g->still_running;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue