Ticket #1359: web.patch

File web.patch, 1.4 KB (added by fulgas, 14 years ago)
  • web.c

     
    3434struct tr_web
    3535{
    3636    unsigned int dying : 1;
    37     int prev_running;
    3837    int still_running;
    3938    CURLM * multi;
    4039    tr_session * session;
     
    177176{
    178177    int added_from_queue = FALSE;
    179178
    180     dbgmsg( "check_run_count: prev_running %d, still_running %d",
    181             g->prev_running, g->still_running );
     179    dbgmsg( "check_run_count: still_running %d",
     180            g->still_running );
    182181
    183     if( 1 )
     182    if(  g->still_running > 0 ) /* there is still tasks to run, either on queue or not */
    184183    {
    185184        CURLMsg * msg;
    186185        int msgs_left;
     
    203202                curl_easy_getinfo( easy, CURLINFO_RESPONSE_CODE, &code );
    204203                curl_multi_remove_handle( g->multi, easy );
    205204                curl_easy_cleanup( easy );
     205                --g->still_running;
    206206                finish_task( task, code );
    207207            }
    208208        } while ( easy );
    209209    }
    210210
    211     g->prev_running = g->still_running;
     211    dbgmsg( "--> still running: %d ... max: %d ... queue size: %d", g->still_running, MAX_CONCURRENT_TASKS, tr_list_size( g->easy_queue ) );
    212212
    213 dbgmsg( "--> still running: %d ... max: %d ... queue size: %d", g->still_running, MAX_CONCURRENT_TASKS, tr_list_size( g->easy_queue ) );
    214 
    215213    while( ( g->still_running < MAX_CONCURRENT_TASKS )
    216214        && ( tr_list_size( g->easy_queue ) > 0 ) )
    217215    {