fix dht unit test
This commit is contained in:
parent
a0a41b6c5e
commit
c8b38dcacd
|
@ -1537,13 +1537,23 @@ int test_main()
|
|||
g_sent_packets.clear();
|
||||
send_dht_response(node, response, next_node, nodes_t(), "11", 1234, peers[1]);
|
||||
|
||||
TEST_CHECK(g_sent_packets.empty());
|
||||
for (std::list<std::pair<udp::endpoint, entry> >::iterator i = g_sent_packets.begin()
|
||||
, end(g_sent_packets.end()); i != end; ++i)
|
||||
{
|
||||
// fprintf(stderr, " %s:%d: %s\n", i->first.address().to_string(ec).c_str()
|
||||
// , i->first.port(), i->second.to_string().c_str());
|
||||
TEST_EQUAL(i->second["q"].string(), "announce_peer");
|
||||
}
|
||||
|
||||
g_sent_packets.clear();
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
for (std::set<tcp::endpoint>::iterator peer = peers[i].begin(); peer != peers[i].end(); ++peer)
|
||||
{
|
||||
TEST_CHECK(std::find(g_got_peers.begin(), g_got_peers.end(), *peer) != g_got_peers.end());
|
||||
}
|
||||
}
|
||||
g_got_peers.clear();
|
||||
} while (false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue