sync lt to rc_0_13 branch

This commit is contained in:
Marcos Pinto 2007-12-01 04:07:11 +00:00
parent cfe1bd241d
commit f757efde4d
1 changed files with 20 additions and 0 deletions

View File

@ -766,6 +766,8 @@ namespace detail
mutex::scoped_lock l2(m_checker_impl.m_mutex);
// abort the checker thread
m_checker_impl.m_abort = true;
m_io_service.stop();
}
void session_impl::set_port_filter(port_filter const& f)
@ -1572,6 +1574,24 @@ namespace detail
}
while (!m_abort);
ptime end = time_now() + seconds(m_settings.stop_tracker_timeout);
while (time_now() < end && !m_tracker_manager.empty())
{
m_io_service.reset();
m_io_service.poll();
// sleep 200 milliseconds
boost::xtime xt;
boost::xtime_get(&xt, boost::TIME_UTC);
boost::int64_t nsec = xt.nsec + 200 * 1000000;
if (nsec > 1000000000)
{
nsec -= 1000000000;
xt.sec += 1;
}
xt.nsec = nsec;
boost::thread::sleep(xt);
}
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
(*m_logger) << time_now_string() << " locking mutex\n";
#endif