separate packet type. add coding.

This commit is contained in:
subtly 2015-03-06 07:08:34 +01:00
parent 517a77f9b4
commit 1e91b7d1de

View File

@ -32,6 +32,9 @@ BOOST_AUTO_TEST_SUITE(p2p)
BOOST_AUTO_TEST_CASE(host)
{
auto oldLogVerbosity = g_logVerbosity;
g_logVerbosity = 10;
NetworkPreferences host1prefs(30301, "127.0.0.1", true, true);
NetworkPreferences host2prefs(30302, "127.0.0.1", true, true);
@ -44,10 +47,14 @@ BOOST_AUTO_TEST_CASE(host)
host1.addNode(node2, "127.0.0.1", host2prefs.listenPort, host2prefs.listenPort);
this_thread::sleep_for(chrono::seconds(1));
this_thread::sleep_for(chrono::seconds(3));
BOOST_REQUIRE_EQUAL(host1.peerCount(), 1);
BOOST_REQUIRE_EQUAL(host2.peerCount(), host1.peerCount());
auto host1peerCount = host1.peerCount();
auto host2peerCount = host2.peerCount();
BOOST_REQUIRE_EQUAL(host1peerCount, 1);
BOOST_REQUIRE_EQUAL(host2peerCount, 1);
g_logVerbosity = oldLogVerbosity;
}
BOOST_AUTO_TEST_CASE(save_nodes)
@ -71,7 +78,7 @@ BOOST_AUTO_TEST_CASE(save_nodes)
for (auto const& h: hosts)
host2.addNode(h->id(), "127.0.0.1", h->listenPort(), h->listenPort());
this_thread::sleep_for(chrono::milliseconds(1000));
this_thread::sleep_for(chrono::milliseconds(2000));
bytes firstHostNetwork(host.saveNetwork());
bytes secondHostNetwork(host.saveNetwork());