From 36cf59c7057eba113a5fdbb955225d46e17e4f96 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Thu, 20 Feb 2014 19:52:47 -0300 Subject: [PATCH] prioritize trackers. announce to dht even if paused. another try to fix #159. 0.9.17. --- libtorrent/src/torrent.cpp | 19 +++++++++++++------ src/clientversion.h | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libtorrent/src/torrent.cpp b/libtorrent/src/torrent.cpp index c8016289..79698f6c 100644 --- a/libtorrent/src/torrent.cpp +++ b/libtorrent/src/torrent.cpp @@ -819,18 +819,21 @@ namespace libtorrent if (m_ses.m_listen_sockets.empty()) return false; if (!m_ses.m_dht) return false; - if (m_torrent_file->is_valid() && !m_files_checked) return false; - if (!m_announce_to_dht) return false; - if (!m_allow_peers) return false; + //if (m_torrent_file->is_valid() && !m_files_checked) return false; + //if (!m_announce_to_dht) return false; + //if (!m_allow_peers) return false; + + //if !m_following => we're tracker. announce even if paused. + if(!m_allow_peers && m_following) return false; // if we don't have the metadata, and we're waiting // for a web server to serve it to us, no need to announce // because the info-hash is just the URL hash - if (!m_torrent_file->is_valid() && !m_url.empty()) return false; + //if (!m_torrent_file->is_valid() && !m_url.empty()) return false; // try to reduce the level of useless dht tracker requests by not // announcing empty torrents we do not follow. - if (!m_following && last_have() == -1 ) return false; + //if (!m_following && last_have() == -1 ) return false; // don't announce private torrents if (m_torrent_file->is_valid() && m_torrent_file->priv()) return false; @@ -2078,7 +2081,7 @@ namespace libtorrent if (!m_name) return; if (!should_announce_dht()) return; - TORRENT_ASSERT(m_allow_peers); + //TORRENT_ASSERT(m_allow_peers); // [MF] use m_dht->announce with myself=false to update dht tracker with peers we know { @@ -7333,6 +7336,7 @@ namespace libtorrent // if we don't have metadata, we need to announce // before checking files, to get peers to // request the metadata from +#if 0 if (!m_files_checked && valid_metadata()) { #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING @@ -7340,6 +7344,7 @@ namespace libtorrent #endif return; } +#endif if (!m_torrent_file->is_valid() && !m_url.empty()) { #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING @@ -7359,6 +7364,8 @@ namespace libtorrent m_ses.prioritize_dht(shared_from_this()); } #endif + //[MF] return from here. just DHT trackers used. + return; if (!m_trackers.empty()) { diff --git a/src/clientversion.h b/src/clientversion.h index 8ed6bdcc..e76f4544 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -8,7 +8,7 @@ // These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 9 -#define CLIENT_VERSION_REVISION 16 +#define CLIENT_VERSION_REVISION 17 #define CLIENT_VERSION_BUILD 0 // Set to true for release, false for prerelease or test build