mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-10 14:58:05 +00:00
incompatible dht change2: "a" => "x"
This commit is contained in:
parent
5b98b52901
commit
7275eb698c
@ -60,9 +60,9 @@ query = 'get_peers'
|
||||
|
||||
print 'test random info-hashes'
|
||||
for i in xrange(1, 30000):
|
||||
send_dht_message({'a': {'id': node_id, 'info_hash': random_key()}, 'q': query, 'z': 'q', 't': '%d' % i})
|
||||
send_dht_message({'x': {'id': node_id, 'info_hash': random_key()}, 'q': query, 'z': 'q', 't': '%d' % i})
|
||||
|
||||
print 'test random peer-ids'
|
||||
for i in xrange(1, 30000):
|
||||
send_dht_message({'a': {'id': random_key(), 'info_hash': random_key()}, 'q': query, 'z': 'q', 't': '%d' % i})
|
||||
send_dht_message({'x': {'id': random_key(), 'info_hash': random_key()}, 'q': query, 'z': 'q', 't': '%d' % i})
|
||||
|
||||
|
@ -207,7 +207,7 @@ bool find_data::invoke(observer_ptr o)
|
||||
entry e;
|
||||
e["z"] = "q";
|
||||
e["q"] = "get_peers";
|
||||
entry& a = e["a"];
|
||||
entry& a = e["x"];
|
||||
a["info_hash"] = m_target.to_string();
|
||||
if (m_noseeds) a["noseed"] = 1;
|
||||
return m_node.m_rpc.invoke(e, o->target_ep(), o);
|
||||
|
@ -283,7 +283,7 @@ namespace
|
||||
entry e;
|
||||
e["z"] = "q";
|
||||
e["q"] = "announce_peer";
|
||||
entry& a = e["a"];
|
||||
entry& a = e["x"];
|
||||
a["info_hash"] = ih.to_string();
|
||||
a["port"] = listen_port;
|
||||
a["token"] = i->second;
|
||||
@ -608,7 +608,7 @@ void node_impl::incoming_request(msg const& m, entry& e)
|
||||
|
||||
key_desc_t top_desc[] = {
|
||||
{"q", lazy_entry::string_t, 0, 0},
|
||||
{"a", lazy_entry::dict_t, 0, key_desc_t::parse_children},
|
||||
{"x", lazy_entry::dict_t, 0, key_desc_t::parse_children},
|
||||
{"id", lazy_entry::string_t, 20, key_desc_t::last_child},
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ bool refresh::invoke(observer_ptr o)
|
||||
entry e;
|
||||
e["z"] = "q";
|
||||
e["q"] = "find_node";
|
||||
entry& a = e["a"];
|
||||
entry& a = e["x"];
|
||||
a["target"] = target().to_string();
|
||||
return m_node.m_rpc.invoke(e, o->target_ep(), o);
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ bool rpc_manager::invoke(entry& e, udp::endpoint target_addr
|
||||
if (m_destructing) return false;
|
||||
|
||||
e["z"] = "q";
|
||||
entry& a = e["a"];
|
||||
entry& a = e["x"];
|
||||
add_our_id(a);
|
||||
|
||||
std::string transaction_id;
|
||||
|
@ -107,7 +107,7 @@ void send_dht_msg(node_impl& node, char const* msg, udp::endpoint const& ep
|
||||
e["q"] = msg;
|
||||
e["t"] = t;
|
||||
e["z"] = "q";
|
||||
entry::dictionary_type& a = e["a"].dict();
|
||||
entry::dictionary_type& a = e["x"].dict();
|
||||
a["id"] = generate_next().to_string();
|
||||
if (info_hash) a["info_hash"] = std::string(info_hash, 20);
|
||||
if (name) a["n"] = name;
|
||||
|
Loading…
Reference in New Issue
Block a user