Browse Source

id(ip) is now enforced

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
a28de30fce
  1. 1
      libtorrent/test/compile-dht.sh
  2. 4
      libtorrent/test/test_dht.cpp

1
libtorrent/test/compile-dht.sh

@ -0,0 +1 @@
gcc -o test_dht test_dht.cpp -I../include/ -DBOOST_ASIO_SEPARATE_COMPILATION -lboost_system -lssl -lpthread .libs/libtest.a ../src/.libs/libtorrent-rasterbar.a -lrt

4
libtorrent/test/test_dht.cpp

@ -108,7 +108,8 @@ void send_dht_msg(node_impl& node, char const* msg, udp::endpoint const& ep
e["t"] = t; e["t"] = t;
e["z"] = "q"; e["z"] = "q";
entry::dictionary_type& a = e["x"].dict(); entry::dictionary_type& a = e["x"].dict();
a["id"] = generate_next().to_string(); //a["id"] = generate_next().to_string();
a["id"] = generate_id(ep.address()).to_string();
if (info_hash) a["infoHash"] = std::string(info_hash, 20); if (info_hash) a["infoHash"] = std::string(info_hash, 20);
if (name) a["n"] = name; if (name) a["n"] = name;
if (!token.empty()) a["token"] = token; if (!token.empty()) a["token"] = token;
@ -126,6 +127,7 @@ void send_dht_msg(node_impl& node, char const* msg, udp::endpoint const& ep
// this yields a lot of output. too much // this yields a lot of output. too much
// std::cerr << "sending: " << e << "\n"; // std::cerr << "sending: " << e << "\n";
#endif #endif
//fprintf(stderr, "sending: %s\n", msg_buf);
lazy_entry decoded; lazy_entry decoded;
error_code ec; error_code ec;

Loading…
Cancel
Save