fix for crashes when stopping or restarting DHT

This commit is contained in:
Arvid Norberg
2007-02-25 09:42:43 +00:00
parent fcc9c49608
commit 7888b72e12
5 changed files with 61 additions and 13 deletions

View File

@@ -1507,7 +1507,11 @@ namespace libtorrent { namespace detail
void session_impl::start_dht(entry const& startup_state)
{
mutex_t::scoped_lock l(m_mutex);
m_dht.reset();
if (m_dht)
{
m_dht->stop();
m_dht.reset();
}
m_dht.reset(new dht::dht_tracker(m_io_service
, m_dht_settings, m_listen_interface.address()
, startup_state));
@@ -1516,6 +1520,7 @@ namespace libtorrent { namespace detail
void session_impl::stop_dht()
{
mutex_t::scoped_lock l(m_mutex);
m_dht->stop();
m_dht.reset();
}