From b0ae8d3a146ed216971dfec8f60a985c67656771 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 21 Feb 2007 17:15:47 +0000 Subject: [PATCH] tracker fixes for trackerless torrents --- include/libtorrent/kademlia/dht_tracker.hpp | 2 +- include/libtorrent/session.hpp | 9 ++------- src/session_impl.cpp | 2 +- src/torrent.cpp | 7 +++++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/libtorrent/kademlia/dht_tracker.hpp b/include/libtorrent/kademlia/dht_tracker.hpp index e97b692af..997e58a2a 100644 --- a/include/libtorrent/kademlia/dht_tracker.hpp +++ b/include/libtorrent/kademlia/dht_tracker.hpp @@ -89,7 +89,7 @@ namespace libtorrent { namespace dht void refresh_timeout(asio::error_code const& e); void tick(asio::error_code const& e); - // translate bittorrent kademlia message into the generice kademlia message + // translate bittorrent kademlia message into the generic kademlia message // used by the library void on_receive(asio::error_code const& error, size_t bytes_transferred); void on_bootstrap(); diff --git a/include/libtorrent/session.hpp b/include/libtorrent/session.hpp index ed0f84bca..454b34f7e 100755 --- a/include/libtorrent/session.hpp +++ b/include/libtorrent/session.hpp @@ -62,8 +62,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/resource_request.hpp" -#if !defined(NDEBUG) && defined(_MSC_VER) -# include +#ifdef _MSC_VER # include #endif @@ -79,16 +78,12 @@ namespace libtorrent // workaround for microsofts // hardware exceptions that makes // it hard to debug stuff -#if defined(_MSC_VER) +#ifdef _MSC_VER struct eh_initializer { eh_initializer() { -#ifndef NDEBUG - _clearfp(); - _controlfp(_EM_INEXACT | _EM_UNDERFLOW, _MCW_EM ); ::_set_se_translator(straight_to_debugger); -#endif } static void straight_to_debugger(unsigned int, _EXCEPTION_POINTERS*) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index f72c72f6b..f292362f4 100755 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1077,7 +1077,7 @@ namespace libtorrent { namespace detail // or if the torrent itself thinks we should request. Do not build // a request in case the torrent doesn't have any trackers if ((!i->second->is_paused() || i->second->should_request()) - && !i->second->torrent_file().trackers().empty()) + && !i->second->trackers().empty()) { tracker_request req = i->second->generate_tracker_request(); req.listen_port = m_listen_interface.port(); diff --git a/src/torrent.cpp b/src/torrent.cpp index eab84cd26..47afcfa60 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -379,10 +379,13 @@ namespace libtorrent m_connections_quota.given = 100; m_uploads_quota.max = std::numeric_limits::max(); m_connections_quota.max = std::numeric_limits::max(); - m_trackers.push_back(announce_entry(tracker_url)); + if (tracker_url) + { + m_trackers.push_back(announce_entry(tracker_url)); + m_torrent_file.add_tracker(tracker_url); + } m_policy.reset(new policy(this)); - m_torrent_file.add_tracker(tracker_url); #ifndef TORRENT_DISABLE_DHT if (should_announce_dht()) {