add backwards compatible reading of IP field in DHT messages

This commit is contained in:
Arvid Norberg 2013-12-20 04:47:41 +00:00
parent a85cdb2d1a
commit 412842365a
1 changed files with 10 additions and 0 deletions

View File

@ -228,6 +228,15 @@ void node_impl::incoming(msg const& m)
char y = *(y_ent->string_ptr());
lazy_entry const* ext_ip = m.message.dict_find_string("ip");
// backwards compatibility
if (ext_ip == NULL)
{
lazy_entry const* r = m.message.dict_find_dict("r");
if (r)
ext_ip = r->dict_find_string("ip");
}
#if TORRENT_USE_IPV6
if (ext_ip && ext_ip->string_length() >= 16)
{
@ -316,6 +325,7 @@ namespace
a["port"] = listen_port;
a["token"] = i->second;
a["seed"] = int(seed);
// TODO: 3 if uTP is enabled, we should say "implied_port": 1
node.m_rpc.invoke(e, i->first.ep(), o);
}
}