more dht fixes. polished client test output some
This commit is contained in:
@@ -839,7 +839,7 @@ int main(int ac, char* av[])
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << "* " << esc("37") << std::setw(40)
|
out << "- " << esc("37") << std::setw(40)
|
||||||
<< std::setiosflags(std::ios::left);
|
<< std::setiosflags(std::ios::left);
|
||||||
if (h.has_metadata())
|
if (h.has_metadata())
|
||||||
{
|
{
|
||||||
@@ -888,11 +888,11 @@ int main(int ac, char* av[])
|
|||||||
out << (s.progress*100) << "% ";
|
out << (s.progress*100) << "% ";
|
||||||
out << progress_bar(s.progress, 49, progress_bar_color);
|
out << progress_bar(s.progress, 49, progress_bar_color);
|
||||||
out << "\n";
|
out << "\n";
|
||||||
out << "total downloaded: " << esc("32") << s.total_done << esc("0") << " Bytes ";
|
out << " total downloaded: " << esc("32") << s.total_done << esc("0") << " Bytes ";
|
||||||
out << "peers: " << s.num_peers << " "
|
out << "peers: " << s.num_peers << " "
|
||||||
<< "seeds: " << s.num_seeds << " "
|
<< "seeds: " << s.num_seeds << " "
|
||||||
<< "distributed copies: " << s.distributed_copies << "\n"
|
<< "distributed copies: " << s.distributed_copies << "\n"
|
||||||
<< "download: " << esc("32") << add_suffix(s.download_rate) << "/s " << esc("0")
|
<< " download: " << esc("32") << add_suffix(s.download_rate) << "/s " << esc("0")
|
||||||
<< "(" << esc("32") << add_suffix(s.total_download) << esc("0") << ") ";
|
<< "(" << esc("32") << add_suffix(s.total_download) << esc("0") << ") ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -905,7 +905,7 @@ int main(int ac, char* av[])
|
|||||||
if (s.state != torrent_status::seeding)
|
if (s.state != torrent_status::seeding)
|
||||||
{
|
{
|
||||||
boost::posix_time::time_duration t = s.next_announce;
|
boost::posix_time::time_duration t = s.next_announce;
|
||||||
out << "next announce: " << esc("37") <<
|
out << " next announce: " << esc("37") <<
|
||||||
boost::posix_time::to_simple_string(t) << esc("0") << " ";
|
boost::posix_time::to_simple_string(t) << esc("0") << " ";
|
||||||
out << "tracker: " << s.current_tracker << "\n";
|
out << "tracker: " << s.current_tracker << "\n";
|
||||||
}
|
}
|
||||||
|
@@ -1520,6 +1520,7 @@ namespace libtorrent { namespace detail
|
|||||||
void session_impl::stop_dht()
|
void session_impl::stop_dht()
|
||||||
{
|
{
|
||||||
mutex_t::scoped_lock l(m_mutex);
|
mutex_t::scoped_lock l(m_mutex);
|
||||||
|
if (!m_dht) return;
|
||||||
m_dht->stop();
|
m_dht->stop();
|
||||||
m_dht = 0;
|
m_dht = 0;
|
||||||
}
|
}
|
||||||
@@ -1575,12 +1576,15 @@ namespace libtorrent { namespace detail
|
|||||||
|
|
||||||
session_impl::~session_impl()
|
session_impl::~session_impl()
|
||||||
{
|
{
|
||||||
{
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
// lock the main thread and abort it
|
stop_dht();
|
||||||
mutex_t::scoped_lock l(m_mutex);
|
#endif
|
||||||
m_abort = true;
|
// lock the main thread and abort it
|
||||||
m_io_service.stop();
|
mutex_t::scoped_lock l(m_mutex);
|
||||||
}
|
m_abort = true;
|
||||||
|
m_io_service.stop();
|
||||||
|
l.unlock();
|
||||||
|
|
||||||
m_thread->join();
|
m_thread->join();
|
||||||
|
|
||||||
// it's important that the main thread is closed completely before
|
// it's important that the main thread is closed completely before
|
||||||
|
Reference in New Issue
Block a user