Ignore:
Timestamp:
05/26/09 20:02:37 (10 years ago)
Author:
Eoin
Message:

Fixed the starting (or not) of added torrents.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/halSession.cpp

    r761 r764  
    416416        HAL_DEV_MSG(hal::wform(L"Schedual absolute action %1% at %2%") % action % time); 
    417417 
    418         action_timer_.cancel(); 
    419  
    420         action_timer_.expires_at(time); 
    421         action_timer_.async_wait(bind(&bit_impl::execute_action, this, _1, action)); 
    422 } 
     418        boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); 
     419        assert(time > now); 
     420 
     421        schedual_action(time - now, action); 
     422} 
     423 
    423424void bit_impl::schedual_action(boost::posix_time::time_duration duration, bit::timeout_actions action) 
    424425{ 
    425426        HAL_DEV_MSG(hal::wform(L"Schedual relative action %1% in %2%") % action % duration); 
    426427 
    427         action_timer_.cancel(); 
     428        schedual_cancel(); 
    428429 
    429430        action_timer_.expires_from_now(duration); 
     
    435436        HAL_DEV_MSG(hal::wform(L"Schedual absolute callback %1%") % time); 
    436437 
    437         action_timer_.cancel(); 
    438  
    439         action_timer_.expires_at(time); 
    440         action_timer_.async_wait(bind(&bit_impl::execute_callback, this, _1, action)); 
    441 } 
     438        boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); 
     439        assert(time > now); 
     440 
     441        schedual_callback(time - now, action); 
     442} 
     443 
    442444void bit_impl::schedual_callback(boost::posix_time::time_duration duration, action_callback_t action) 
    443445{ 
    444446        HAL_DEV_MSG(hal::wform(L"Schedual relative callback %1%") % duration); 
    445447 
    446         action_timer_.cancel(); 
     448        schedual_cancel(); 
    447449 
    448450        action_timer_.expires_from_now(duration); 
    449451        action_timer_.async_wait(bind(&bit_impl::execute_callback, this, _1, action)); 
    450452}        
     453 
     454void bit_impl::schedual_cancel() 
     455{ 
     456        if (action_timer_.cancel() > 0) 
     457                HAL_DEV_MSG(L"Schedualed action canceled"); 
     458} 
    451459 
    452460void bit_impl::start_alert_handler() 
Note: See TracChangeset for help on using the changeset viewer.