lowered the dht timeout from 20 to 10 seconds. added support to parse values-messages as described in the spec (even though that format is very very rare).
This commit is contained in:
parent
2dbfa156d3
commit
4b68dce5f0
|
@ -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<tcp::endpoint>(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<tcp::endpoint>(i));
|
||||
}
|
||||
else
|
||||
{
|
||||
// assume it's uTorrent/libtorrent format
|
||||
read_endpoint_list<tcp::endpoint>(n, m.peers);
|
||||
}
|
||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||
TORRENT_LOG(dht_tracker) << " peers: " << m.peers.size();
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue