summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Pinto <markybob@dipconsultants.com>2007-12-01 04:07:11 +0000
committerMarcos Pinto <markybob@dipconsultants.com>2007-12-01 04:07:11 +0000
commitf757efde4d2e2a328ce447c3a97e179a97264267 (patch)
tree6d19e9477e1b65360633bdb06ad6006c51edf365
parentcfe1bd241d0009c01597ddda5d59f99dfe105141 (diff)
downloaddeluge-f757efde4d2e2a328ce447c3a97e179a97264267.tar.gz
deluge-f757efde4d2e2a328ce447c3a97e179a97264267.tar.bz2
deluge-f757efde4d2e2a328ce447c3a97e179a97264267.zip
sync lt to rc_0_13 branch
-rwxr-xr-xlibtorrent/src/session_impl.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/libtorrent/src/session_impl.cpp b/libtorrent/src/session_impl.cpp
index 833d49777..5c4611cf4 100755
--- a/libtorrent/src/session_impl.cpp
+++ b/libtorrent/src/session_impl.cpp
@@ -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