fix ping-timeouts

This commit is contained in:
subtly 2015-01-25 19:54:15 -08:00
parent 2ed2a8ec8e
commit 57e1acfbd6
2 changed files with 14 additions and 10 deletions

View File

@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(host)
host1.addNode(node2, "127.0.0.1", host2prefs.listenPort, host2prefs.listenPort); 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_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()

View File

@ -34,12 +34,21 @@ BOOST_AUTO_TEST_CASE(topic)
{ {
cnote << "Testing Whisper..."; cnote << "Testing Whisper...";
auto oldLogVerbosity = g_logVerbosity; auto oldLogVerbosity = g_logVerbosity;
g_logVerbosity = 5; g_logVerbosity = 0;
Host phOther("Test", NetworkPreferences(30303, "127.0.0.1", true, true)); Host phOther("Test", NetworkPreferences(30303, "127.0.0.1", false, true));
auto whOther = phOther.registerCapability(new WhisperHost()); auto whOther = phOther.registerCapability(new WhisperHost());
phOther.start(); phOther.start();
Host ph("Test", NetworkPreferences(30300, "127.0.0.1", false, true));
auto wh = ph.registerCapability(new WhisperHost());
ph.start();
this_thread::sleep_for(chrono::milliseconds(100));
ph.addNode(phOther.id(), "127.0.0.1", 30303, 30303);
this_thread::sleep_for(chrono::milliseconds(500));
bool started = false; bool started = false;
unsigned result = 0; unsigned result = 0;
std::thread listener([&]() std::thread listener([&]()
@ -61,16 +70,11 @@ BOOST_AUTO_TEST_CASE(topic)
} }
this_thread::sleep_for(chrono::milliseconds(50)); this_thread::sleep_for(chrono::milliseconds(50));
} }
}); });
Host ph("Test", NetworkPreferences(30300, "127.0.0.1", true, true));
auto wh = ph.registerCapability(new WhisperHost());
ph.start();
ph.addNode(phOther.id(), "127.0.0.1", 30303, 30303);
this_thread::sleep_for(chrono::milliseconds(300));
while (!started) while (!started)
this_thread::sleep_for(chrono::milliseconds(25)); this_thread::sleep_for(chrono::milliseconds(1));
KeyPair us = KeyPair::create(); KeyPair us = KeyPair::create();