diff --git a/examples/client_test.cpp b/examples/client_test.cpp index f4b6f49b1..64aec184c 100755 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -839,7 +839,7 @@ int main(int ac, char* av[]) ++i; } - out << "* " << esc("37") << std::setw(40) + out << "- " << esc("37") << std::setw(40) << std::setiosflags(std::ios::left); if (h.has_metadata()) { @@ -888,11 +888,11 @@ int main(int ac, char* av[]) out << (s.progress*100) << "% "; out << progress_bar(s.progress, 49, progress_bar_color); 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 << " " << "seeds: " << s.num_seeds << " " << "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") << ") "; } else @@ -905,7 +905,7 @@ int main(int ac, char* av[]) if (s.state != torrent_status::seeding) { 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") << " "; out << "tracker: " << s.current_tracker << "\n"; } diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 07c9358e9..a761af221 100755 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1520,6 +1520,7 @@ namespace libtorrent { namespace detail void session_impl::stop_dht() { mutex_t::scoped_lock l(m_mutex); + if (!m_dht) return; m_dht->stop(); m_dht = 0; } @@ -1575,12 +1576,15 @@ namespace libtorrent { namespace detail session_impl::~session_impl() { - { - // lock the main thread and abort it - mutex_t::scoped_lock l(m_mutex); - m_abort = true; - m_io_service.stop(); - } +#ifndef TORRENT_DISABLE_DHT + stop_dht(); +#endif + // lock the main thread and abort it + mutex_t::scoped_lock l(m_mutex); + m_abort = true; + m_io_service.stop(); + l.unlock(); + m_thread->join(); // it's important that the main thread is closed completely before