diff --git a/src/kademlia/dht_tracker.cpp b/src/kademlia/dht_tracker.cpp index 8e7d03589..3b2e9a50b 100644 --- a/src/kademlia/dht_tracker.cpp +++ b/src/kademlia/dht_tracker.cpp @@ -477,10 +477,24 @@ namespace libtorrent { namespace dht if (id.size() != 20) throw std::runtime_error("invalid size of id"); std::copy(id.begin(), id.end(), m.id.begin()); - if (entry const* n = r.find_key("values")) + if (entry const* n = r.find_key("values")) { m.peers.clear(); - read_endpoint_list(n, m.peers); + if (n->list().size() == 1) + { + // assume it's mainline format + std::string const& peers = n->list().front().string(); + std::string::const_iterator i = peers.begin(); + std::string::const_iterator end = peers.end(); + + while (std::distance(i, end) >= 6) + m.peers.push_back(read_v4_endpoint(i)); + } + else + { + // assume it's uTorrent/libtorrent format + read_endpoint_list(n, m.peers); + } #ifdef TORRENT_DHT_VERBOSE_LOGGING TORRENT_LOG(dht_tracker) << " peers: " << m.peers.size(); #endif diff --git a/src/kademlia/rpc_manager.cpp b/src/kademlia/rpc_manager.cpp index e17c80c00..93ac45ae0 100644 --- a/src/kademlia/rpc_manager.cpp +++ b/src/kademlia/rpc_manager.cpp @@ -201,7 +201,7 @@ time_duration rpc_manager::tick() using boost::posix_time::microsec_clock; - const int timeout_ms = 20 * 1000; + const int timeout_ms = 10 * 1000; // look for observers that has timed out