improved forward compatibility in DHT

This commit is contained in:
Arvid Norberg 2009-09-27 00:40:05 +00:00
parent c631c00653
commit 5b563d5522
2 changed files with 20 additions and 1 deletions

View File

@ -78,6 +78,7 @@ release 0.14.7
* resume data alerts are always posted, regardless of alert mask
* added wait_for_alert to python binding
* improved invalid filename character replacement
* improved forward compatibility in DHT
release 0.14.6

View File

@ -664,7 +664,25 @@ void node_impl::incoming_request(msg const& m, entry& e)
}
else
{
incoming_error(e, "unknown message");
// if we don't recognize the message but there's a
// 'target' or 'info_hash' in the arguments, treat it
// as find_node to be future compatible
lazy_entry const* target_ent = arg_ent->dict_find_string("target");
if (target_ent == 0 || target_ent->string_length() != 20)
{
target_ent = arg_ent->dict_find_string("info_hash");
if (target_ent == 0 || target_ent->string_length() != 20)
{
incoming_error(e, "unknown message");
return;
}
}
sha1_hash target(target_ent->string_ptr());
nodes_t n;
// always return nodes as well as peers
m_table.find_node(target, n, 0);
write_nodes_entry(reply, n);
return;
}
}