aboutsummaryrefslogtreecommitdiffstats
path: root/whisperTopic.cpp
diff options
context:
space:
mode:
authorjhuntley <jhuntley@houghtonassociates.com>2015-02-27 05:05:53 +0800
committerjhuntley <jhuntley@houghtonassociates.com>2015-03-05 00:18:32 +0800
commite229b5d291eefbf05e77988149d3ba2dc0059575 (patch)
treea8bf8cf138f206f8d37dcc1429b0e4e65ab0e126 /whisperTopic.cpp
parent5ae585f7cf21ae281f564d0edbad1251129f256d (diff)
downloaddexon-solidity-e229b5d291eefbf05e77988149d3ba2dc0059575.tar.gz
dexon-solidity-e229b5d291eefbf05e77988149d3ba2dc0059575.tar.zst
dexon-solidity-e229b5d291eefbf05e77988149d3ba2dc0059575.zip
Revert all asio.h includes except for in 2 files, DebuggingStateWrapper.h and Transact.cpp. After enabling WIN32_LEAN_AND_MEAN, all the asio.h include issues, commit 20b6e24ffcab088e71092e07030a377d3135da3c, went away.
Diffstat (limited to 'whisperTopic.cpp')
-rw-r--r--whisperTopic.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/whisperTopic.cpp b/whisperTopic.cpp
index 0937ab92..0ea681b6 100644
--- a/whisperTopic.cpp
+++ b/whisperTopic.cpp
@@ -20,8 +20,6 @@
*/
#include <functional>
-// Make sure boost/asio.hpp is included before windows.h.
-#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp>
#include <libp2p/Host.h>
@@ -44,10 +42,10 @@ BOOST_AUTO_TEST_CASE(topic)
Host host1("Test", NetworkPreferences(30303, "127.0.0.1", false, true));
auto whost1 = host1.registerCapability(new WhisperHost());
host1.start();
-
+
while (!host1.isStarted())
this_thread::sleep_for(chrono::milliseconds(2));
-
+
bool started = false;
unsigned result = 0;
std::thread listener([&]()
@@ -75,19 +73,19 @@ BOOST_AUTO_TEST_CASE(topic)
}
this_thread::sleep_for(chrono::milliseconds(50));
}
-
+
});
-
+
Host host2("Test", NetworkPreferences(30300, "127.0.0.1", false, true));
auto whost2 = host2.registerCapability(new WhisperHost());
host2.start();
-
+
while (!host2.isStarted())
this_thread::sleep_for(chrono::milliseconds(2));
-
+
this_thread::sleep_for(chrono::milliseconds(100));
host2.addNode(host1.id(), "127.0.0.1", 30303, 30303);
-
+
this_thread::sleep_for(chrono::milliseconds(500));
while (!started)
@@ -111,7 +109,7 @@ BOOST_AUTO_TEST_CASE(forwarding)
cnote << "Testing Whisper forwarding...";
auto oldLogVerbosity = g_logVerbosity;
g_logVerbosity = 0;
-
+
// Host must be configured not to share peers.
Host host1("Listner", NetworkPreferences(30303, "", false, true));
host1.setIdealPeerCount(0);
@@ -119,7 +117,7 @@ BOOST_AUTO_TEST_CASE(forwarding)
host1.start();
while (!host1.isStarted())
this_thread::sleep_for(chrono::milliseconds(2));
-
+
unsigned result = 0;
bool done = false;
@@ -146,7 +144,7 @@ BOOST_AUTO_TEST_CASE(forwarding)
}
});
-
+
// Host must be configured not to share peers.
Host host2("Forwarder", NetworkPreferences(30305, "", false, true));
host2.setIdealPeerCount(1);
@@ -154,7 +152,7 @@ BOOST_AUTO_TEST_CASE(forwarding)
host2.start();
while (!host2.isStarted())
this_thread::sleep_for(chrono::milliseconds(2));
-
+
Public fwderid;
bool startedForwarder = false;
std::thread forwarder([&]()
@@ -214,7 +212,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding)
unsigned result = 0;
bool done = false;
-
+
// Host must be configured not to share peers.
Host host1("Forwarder", NetworkPreferences(30305, "", false, true));
host1.setIdealPeerCount(1);
@@ -227,7 +225,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding)
std::thread forwarder([&]()
{
setThreadName("forwarder");
-
+
this_thread::sleep_for(chrono::milliseconds(500));
// ph.addNode("127.0.0.1", 30303, 30303);
@@ -249,7 +247,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding)
while (!startedForwarder)
this_thread::sleep_for(chrono::milliseconds(2));
-
+
{
Host host2("Sender", NetworkPreferences(30300, "", false, true));
host2.setIdealPeerCount(1);
@@ -261,7 +259,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding)
while (!host2.peerCount())
this_thread::sleep_for(chrono::milliseconds(5));
-
+
KeyPair us = KeyPair::create();
whost2->post(us.sec(), RLPStream().append(1).out(), BuildTopic("test"));
this_thread::sleep_for(chrono::milliseconds(250));