fix naming in test_dht. don't include deprecated header (lazy_entry) unless required
This commit is contained in:
parent
82900c441c
commit
3891f77253
|
@ -36,12 +36,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/aux_/throw.hpp"
|
#include "libtorrent/aux_/throw.hpp"
|
||||||
#include "libtorrent/aux_/path.hpp"
|
#include "libtorrent/aux_/path.hpp"
|
||||||
#include "libtorrent/torrent.hpp"
|
#include "libtorrent/torrent.hpp"
|
||||||
#include "libtorrent/lazy_entry.hpp"
|
|
||||||
#include "libtorrent/peer_class.hpp"
|
#include "libtorrent/peer_class.hpp"
|
||||||
#include "libtorrent/peer_class_type_filter.hpp"
|
#include "libtorrent/peer_class_type_filter.hpp"
|
||||||
|
|
||||||
#if TORRENT_ABI_VERSION == 1
|
#if TORRENT_ABI_VERSION == 1
|
||||||
#include "libtorrent/read_resume_data.hpp"
|
#include "libtorrent/read_resume_data.hpp"
|
||||||
|
#include "libtorrent/lazy_entry.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using libtorrent::aux::session_impl;
|
using libtorrent::aux::session_impl;
|
||||||
|
|
|
@ -171,7 +171,7 @@ find_packet(udp::endpoint ep)
|
||||||
{ return p.first == ep; });
|
{ return p.first == ep; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void lazy_from_entry(entry const& e, bdecode_node& l)
|
void node_from_entry(entry const& e, bdecode_node& l)
|
||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
static char inbuf[1500];
|
static char inbuf[1500];
|
||||||
|
@ -272,7 +272,7 @@ void send_dht_request(node& node, char const* msg, udp::endpoint const& ep
|
||||||
, char const* t = "10", bool has_response = true)
|
, char const* t = "10", bool has_response = true)
|
||||||
{
|
{
|
||||||
// we're about to clear out the backing buffer
|
// we're about to clear out the backing buffer
|
||||||
// for this lazy_entry, so we better clear it now
|
// for this bdecode_node, so we better clear it now
|
||||||
reply->clear();
|
reply->clear();
|
||||||
entry e;
|
entry e;
|
||||||
e["q"] = msg;
|
e["q"] = msg;
|
||||||
|
@ -302,7 +302,7 @@ void send_dht_request(node& node, char const* msg, udp::endpoint const& ep
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_from_entry(i->second, *reply);
|
node_from_entry(i->second, *reply);
|
||||||
g_sent_packets.erase(i);
|
g_sent_packets.erase(i);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1830,7 +1830,7 @@ void test_bootstrap(address(&rand_addr)())
|
||||||
if (g_sent_packets.empty()) return;
|
if (g_sent_packets.empty()) return;
|
||||||
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.front().second, response);
|
node_from_entry(g_sent_packets.front().second, response);
|
||||||
ret = verify_message(response, find_node_desc, find_node_keys, t.error_string);
|
ret = verify_message(response, find_node_desc, find_node_keys, t.error_string);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -1862,7 +1862,7 @@ void test_bootstrap(address(&rand_addr)())
|
||||||
if (g_sent_packets.empty()) return;
|
if (g_sent_packets.empty()) return;
|
||||||
TEST_EQUAL(g_sent_packets.front().first, found_node);
|
TEST_EQUAL(g_sent_packets.front().first, found_node);
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.front().second, response);
|
node_from_entry(g_sent_packets.front().second, response);
|
||||||
ret = verify_message(response, find_node_desc, find_node_keys, t.error_string);
|
ret = verify_message(response, find_node_desc, find_node_keys, t.error_string);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -1934,7 +1934,7 @@ void test_bootstrap_want(address(&rand_addr)())
|
||||||
TEST_EQUAL(g_sent_packets.size(), 1);
|
TEST_EQUAL(g_sent_packets.size(), 1);
|
||||||
TEST_EQUAL(g_sent_packets.front().first, nodesv[0]);
|
TEST_EQUAL(g_sent_packets.front().first, nodesv[0]);
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.front().second, response);
|
node_from_entry(g_sent_packets.front().second, response);
|
||||||
ret = verify_message(response, find_node_desc, find_node_keys, t.error_string);
|
ret = verify_message(response, find_node_desc, find_node_keys, t.error_string);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -2005,7 +2005,7 @@ void test_short_nodes(address(&rand_addr)())
|
||||||
if (g_sent_packets.empty()) return;
|
if (g_sent_packets.empty()) return;
|
||||||
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.front().second, response);
|
node_from_entry(g_sent_packets.front().second, response);
|
||||||
ret = verify_message(response, find_node_desc, find_node_keys, t.error_string);
|
ret = verify_message(response, find_node_desc, find_node_keys, t.error_string);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -2094,7 +2094,7 @@ void test_get_peers(address(&rand_addr)())
|
||||||
if (g_sent_packets.empty()) return;
|
if (g_sent_packets.empty()) return;
|
||||||
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.front().second, response);
|
node_from_entry(g_sent_packets.front().second, response);
|
||||||
ret = verify_message(response, get_peers_desc, get_peers_keys, t.error_string);
|
ret = verify_message(response, get_peers_desc, get_peers_keys, t.error_string);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -2137,7 +2137,7 @@ void test_get_peers(address(&rand_addr)())
|
||||||
if (g_sent_packets.empty()) return;
|
if (g_sent_packets.empty()) return;
|
||||||
TEST_EQUAL(g_sent_packets.front().first, next_node);
|
TEST_EQUAL(g_sent_packets.front().first, next_node);
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.front().second, response);
|
node_from_entry(g_sent_packets.front().second, response);
|
||||||
ret = verify_message(response, get_peers_desc, get_peers_keys, t.error_string);
|
ret = verify_message(response, get_peers_desc, get_peers_keys, t.error_string);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -2239,7 +2239,7 @@ void test_mutable_get(address(&rand_addr)(), bool const with_salt)
|
||||||
if (g_sent_packets.empty()) return;
|
if (g_sent_packets.empty()) return;
|
||||||
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.front().second, response);
|
node_from_entry(g_sent_packets.front().second, response);
|
||||||
bdecode_node get_item_keys[6];
|
bdecode_node get_item_keys[6];
|
||||||
bool const ret = verify_message(response, get_item_desc, get_item_keys, t.error_string);
|
bool const ret = verify_message(response, get_item_desc, get_item_keys, t.error_string);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -2326,7 +2326,7 @@ TORRENT_TEST(immutable_get)
|
||||||
if (g_sent_packets.empty()) return;
|
if (g_sent_packets.empty()) return;
|
||||||
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.front().second, response);
|
node_from_entry(g_sent_packets.front().second, response);
|
||||||
bdecode_node get_item_keys[6];
|
bdecode_node get_item_keys[6];
|
||||||
bool const ret = verify_message(response, get_item_desc, get_item_keys, t.error_string);
|
bool const ret = verify_message(response, get_item_desc, get_item_keys, t.error_string);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -2406,7 +2406,7 @@ TORRENT_TEST(immutable_put)
|
||||||
TEST_CHECK(packet != g_sent_packets.end());
|
TEST_CHECK(packet != g_sent_packets.end());
|
||||||
if (packet == g_sent_packets.end()) continue;
|
if (packet == g_sent_packets.end()) continue;
|
||||||
|
|
||||||
lazy_from_entry(packet->second, response);
|
node_from_entry(packet->second, response);
|
||||||
bdecode_node get_item_keys[6];
|
bdecode_node get_item_keys[6];
|
||||||
bool const ret = verify_message(response, get_item_desc, get_item_keys, t.error_string);
|
bool const ret = verify_message(response, get_item_desc, get_item_keys, t.error_string);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -2437,7 +2437,7 @@ TORRENT_TEST(immutable_put)
|
||||||
TEST_CHECK(packet != g_sent_packets.end());
|
TEST_CHECK(packet != g_sent_packets.end());
|
||||||
if (packet == g_sent_packets.end()) continue;
|
if (packet == g_sent_packets.end()) continue;
|
||||||
|
|
||||||
lazy_from_entry(packet->second, response);
|
node_from_entry(packet->second, response);
|
||||||
bool const ret = verify_message(response, put_immutable_item_desc, put_immutable_item_keys
|
bool const ret = verify_message(response, put_immutable_item_desc, put_immutable_item_keys
|
||||||
, t.error_string);
|
, t.error_string);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -2511,7 +2511,7 @@ TORRENT_TEST(mutable_put)
|
||||||
TEST_CHECK(packet != g_sent_packets.end());
|
TEST_CHECK(packet != g_sent_packets.end());
|
||||||
if (packet == g_sent_packets.end()) continue;
|
if (packet == g_sent_packets.end()) continue;
|
||||||
|
|
||||||
lazy_from_entry(packet->second, response);
|
node_from_entry(packet->second, response);
|
||||||
bdecode_node get_item_keys[6];
|
bdecode_node get_item_keys[6];
|
||||||
bool const ret = verify_message(response, get_item_desc, get_item_keys, t.error_string);
|
bool const ret = verify_message(response, get_item_desc, get_item_keys, t.error_string);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -2542,7 +2542,7 @@ TORRENT_TEST(mutable_put)
|
||||||
TEST_CHECK(packet != g_sent_packets.end());
|
TEST_CHECK(packet != g_sent_packets.end());
|
||||||
if (packet == g_sent_packets.end()) continue;
|
if (packet == g_sent_packets.end()) continue;
|
||||||
|
|
||||||
lazy_from_entry(packet->second, response);
|
node_from_entry(packet->second, response);
|
||||||
bool const ret = verify_message(response, put_mutable_item_desc, put_mutable_item_keys
|
bool const ret = verify_message(response, put_mutable_item_desc, put_mutable_item_keys
|
||||||
, t.error_string);
|
, t.error_string);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -2629,7 +2629,7 @@ TORRENT_TEST(traversal_done)
|
||||||
TEST_CHECK(packet != g_sent_packets.end());
|
TEST_CHECK(packet != g_sent_packets.end());
|
||||||
if (packet == g_sent_packets.end()) continue;
|
if (packet == g_sent_packets.end()) continue;
|
||||||
|
|
||||||
lazy_from_entry(packet->second, response);
|
node_from_entry(packet->second, response);
|
||||||
bdecode_node get_item_keys[6];
|
bdecode_node get_item_keys[6];
|
||||||
bool const ret = verify_message(response, get_item_desc, get_item_keys, t.error_string);
|
bool const ret = verify_message(response, get_item_desc, get_item_keys, t.error_string);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -3254,7 +3254,7 @@ TORRENT_TEST(read_only_node)
|
||||||
{"target", bdecode_node::string_t, 20, key_desc_t::last_child},
|
{"target", bdecode_node::string_t, 20, key_desc_t::last_child},
|
||||||
};
|
};
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.front().second, request);
|
node_from_entry(g_sent_packets.front().second, request);
|
||||||
bool ret = verify_message(request, get_item_desc_ro, parsed, error_string);
|
bool ret = verify_message(request, get_item_desc_ro, parsed, error_string);
|
||||||
|
|
||||||
TEST_CHECK(ret);
|
TEST_CHECK(ret);
|
||||||
|
@ -3284,13 +3284,13 @@ TORRENT_TEST(read_only_node)
|
||||||
TEST_EQUAL(g_sent_packets.size(), 2);
|
TEST_EQUAL(g_sent_packets.size(), 2);
|
||||||
|
|
||||||
// both of them shouldn't have a 'ro' key.
|
// both of them shouldn't have a 'ro' key.
|
||||||
lazy_from_entry(g_sent_packets.front().second, request);
|
node_from_entry(g_sent_packets.front().second, request);
|
||||||
ret = verify_message(request, get_item_desc_ro, parsed, error_string);
|
ret = verify_message(request, get_item_desc_ro, parsed, error_string);
|
||||||
|
|
||||||
TEST_CHECK(ret);
|
TEST_CHECK(ret);
|
||||||
TEST_CHECK(!parsed[3]);
|
TEST_CHECK(!parsed[3]);
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.back().second, request);
|
node_from_entry(g_sent_packets.back().second, request);
|
||||||
ret = verify_message(request, get_item_desc_ro, parsed, error_string);
|
ret = verify_message(request, get_item_desc_ro, parsed, error_string);
|
||||||
|
|
||||||
TEST_CHECK(ret);
|
TEST_CHECK(ret);
|
||||||
|
@ -3728,7 +3728,7 @@ TORRENT_TEST(sample_infohashes)
|
||||||
if (g_sent_packets.empty()) return;
|
if (g_sent_packets.empty()) return;
|
||||||
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
TEST_EQUAL(g_sent_packets.front().first, initial_node);
|
||||||
|
|
||||||
lazy_from_entry(g_sent_packets.front().second, response);
|
node_from_entry(g_sent_packets.front().second, response);
|
||||||
bdecode_node sample_infohashes_keys[6];
|
bdecode_node sample_infohashes_keys[6];
|
||||||
bool const ret = verify_message(response
|
bool const ret = verify_message(response
|
||||||
, sample_infohashes_desc, sample_infohashes_keys, t.error_string);
|
, sample_infohashes_desc, sample_infohashes_keys, t.error_string);
|
||||||
|
|
Loading…
Reference in New Issue