From 6d62e3ab26f1dc980ebe8475817f6982b1bac195 Mon Sep 17 00:00:00 2001 From: jhuntley Date: Thu, 26 Feb 2015 16:05:53 -0500 Subject: [PATCH] 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. --- alethzero/MainWin.h | 3 -- alethzero/OurWebThreeStubServer.h | 1 - alethzero/Transact.cpp | 3 ++ eth/main.cpp | 2 - libethereum/All.h | 3 -- libethereum/Client.h | 2 - libethereum/EthereumHost.h | 3 -- libp2p/Host.cpp | 2 - libp2p/Host.h | 3 -- libp2p/Network.cpp | 2 - libp2p/NodeTable.h | 84 +++++++++++++++--------------- libp2p/Session.h | 5 +- libp2p/UDP.h | 5 +- libwebthree/WebThree.cpp | 2 - libwhisper/Common.h | 3 -- libwhisper/Interface.h | 3 -- libwhisper/Message.h | 3 -- libwhisper/WhisperHost.h | 3 -- libwhisper/WhisperPeer.h | 3 -- mix/AppContext.cpp | 3 -- mix/AppContext.h | 3 -- mix/CodeEditorExtensionManager.cpp | 3 -- mix/DebuggingStateWrapper.h | 3 ++ mix/Extension.cpp | 3 -- mix/Extension.h | 3 -- mix/QContractDefinition.cpp | 3 -- neth/main.cpp | 2 - test/TestHelper.cpp | 2 - test/TestHelper.h | 2 - test/checkRandomTest.cpp | 3 -- test/createRandomTest.cpp | 2 - test/fork.cpp | 2 - test/genesis.cpp | 4 +- test/hexPrefix.cpp | 2 - test/net.cpp | 10 ++-- test/rlp.cpp | 2 - test/state.cpp | 2 - test/trie.cpp | 2 - test/txTest.cpp | 2 - test/vm.cpp | 2 - test/vm.h | 2 - test/whisperTopic.cpp | 32 ++++++------ third/MainWin.cpp | 2 - 43 files changed, 69 insertions(+), 162 deletions(-) diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index 5d2e88168..0a2b3461e 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -27,9 +27,6 @@ #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/alethzero/OurWebThreeStubServer.h b/alethzero/OurWebThreeStubServer.h index 9420a7cac..95cf70438 100644 --- a/alethzero/OurWebThreeStubServer.h +++ b/alethzero/OurWebThreeStubServer.h @@ -20,7 +20,6 @@ */ #include -#include #include #include #include diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index c59c80c39..df6c5258d 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -19,6 +19,9 @@ * @date 2015 */ +// Make sure boost/asio.hpp is included before windows.h. +#include + #include "Transact.h" #include diff --git a/eth/main.cpp b/eth/main.cpp index 705307bac..e3753364f 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -26,8 +26,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/libethereum/All.h b/libethereum/All.h index 9c349d372..24109cb87 100644 --- a/libethereum/All.h +++ b/libethereum/All.h @@ -1,8 +1,5 @@ #pragma once -// Make sure boost/asio.hpp is included before windows.h. -#include - #include "Account.h" #include "CanonBlockChain.h" #include "Client.h" diff --git a/libethereum/Client.h b/libethereum/Client.h index d8fd8356e..5fabca10b 100644 --- a/libethereum/Client.h +++ b/libethereum/Client.h @@ -28,8 +28,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/libethereum/EthereumHost.h b/libethereum/EthereumHost.h index dc61b0637..0f06230ff 100644 --- a/libethereum/EthereumHost.h +++ b/libethereum/EthereumHost.h @@ -29,9 +29,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index 87df889d2..ed0ee653e 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -25,8 +25,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/libp2p/Host.h b/libp2p/Host.h index b15c14055..ce4dfa50c 100644 --- a/libp2p/Host.h +++ b/libp2p/Host.h @@ -31,9 +31,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/libp2p/Network.cpp b/libp2p/Network.cpp index 92db18e93..d004f33d2 100644 --- a/libp2p/Network.cpp +++ b/libp2p/Network.cpp @@ -26,8 +26,6 @@ #include #endif -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/libp2p/NodeTable.h b/libp2p/NodeTable.h index a34602189..10fa921e4 100644 --- a/libp2p/NodeTable.h +++ b/libp2p/NodeTable.h @@ -24,8 +24,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include @@ -58,7 +56,7 @@ class NodeTableEventHandler friend class NodeTable; public: virtual void processEvent(NodeId const& _n, NodeTableEventType const& _e) = 0; - + protected: /// Called by NodeTable on behalf of an implementation (Host) to process new events without blocking nodetable. void processEvents() @@ -77,10 +75,10 @@ protected: for (auto const& e: events) processEvent(e.first, e.second); } - + /// Called by NodeTable to append event. virtual void appendEvent(NodeId _n, NodeTableEventType _e) { Guard l(x_events); m_nodeEventHandler.push_back(_n); m_events[_n] = _e; } - + Mutex x_events; std::list m_nodeEventHandler; std::map m_events; @@ -88,10 +86,10 @@ protected: class NodeTable; inline std::ostream& operator<<(std::ostream& _out, NodeTable const& _nodeTable); - + /** * NodeTable using modified kademlia for node discovery and preference. - * Node table requires an IO service, creates a socket for incoming + * Node table requires an IO service, creates a socket for incoming * UDP messages and implements a kademlia-like protocol. Node requests and * responses are used to build a node table which can be queried to * obtain a list of potential nodes to connect to, and, passes events to @@ -134,69 +132,69 @@ class NodeTable: UDPSocketEvents, public std::enable_shared_from_this using NodeSocket = UDPSocket; using TimePoint = std::chrono::steady_clock::time_point; using EvictionTimeout = std::pair, NodeId>; ///< First NodeId may be evicted and replaced with second NodeId. - + public: NodeTable(ba::io_service& _io, KeyPair _alias, uint16_t _udpPort = 30303); ~NodeTable(); - + /// Returns distance based on xor metric two node ids. Used by NodeEntry and NodeTable. static unsigned distance(NodeId const& _a, NodeId const& _b) { u512 d = _a ^ _b; unsigned ret; for (ret = 0; d >>= 1; ++ret) {}; return ret; } - + /// Set event handler for NodeEntryAdded and NodeEntryRemoved events. void setEventHandler(NodeTableEventHandler* _handler) { m_nodeEventHandler.reset(_handler); } - + /// Called by implementation which provided handler to process NodeEntryAdded/NodeEntryRemoved events. Events are coalesced by type whereby old events are ignored. void processEvents(); - + /// Add node. Node will be pinged if it's not already known. std::shared_ptr addNode(Public const& _pubk, bi::udp::endpoint const& _udp, bi::tcp::endpoint const& _tcp); - + /// Add node. Node will be pinged if it's not already known. std::shared_ptr addNode(Node const& _node); /// To be called when node table is empty. Runs node discovery with m_node.id as the target in order to populate node-table. void discover(); - + /// Returns list of node ids active in node table. std::list nodes() const; - + /// Returns node count. unsigned count() const { return m_nodes.size(); } - + /// Returns snapshot of table. std::list snapshot() const; - + /// Returns true if node id is in node table. bool haveNode(NodeId const& _id) { Guard l(x_nodes); return m_nodes.count(_id) > 0; } - + /// Returns the Node to the corresponding node id or the empty Node if that id is not found. Node node(NodeId const& _id); - + #if defined(BOOST_AUTO_TEST_SUITE) || defined(_MSC_VER) // MSVC includes access specifier in symbol name protected: #else private: #endif - + /// Constants for Kademlia, derived from address space. - + static unsigned const s_addressByteSize = sizeof(NodeId); ///< Size of address type in bytes. static unsigned const s_bits = 8 * s_addressByteSize; ///< Denoted by n in [Kademlia]. static unsigned const s_bins = s_bits - 1; ///< Size of m_state (excludes root, which is us). static unsigned const s_maxSteps = boost::static_log2::value; ///< Max iterations of discovery. (discover) - + /// Chosen constants - + static unsigned const s_bucketSize = 16; ///< Denoted by k in [Kademlia]. Number of nodes stored in each bucket. static unsigned const s_alpha = 3; ///< Denoted by \alpha in [Kademlia]. Number of concurrent FindNode requests. /// Intervals - + /* todo: replace boost::posix_time; change constants to upper camelcase */ boost::posix_time::milliseconds const c_evictionCheckInterval = boost::posix_time::milliseconds(75); ///< Interval at which eviction timeouts are checked. std::chrono::milliseconds const c_reqTimeout = std::chrono::milliseconds(300); ///< How long to wait for requests (evict, find iterations). std::chrono::seconds const c_bucketRefresh = std::chrono::seconds(3600); ///< Refresh interval prevents bucket from becoming stale. [Kademlia] - + struct NodeBucket { unsigned distance; @@ -204,50 +202,50 @@ private: std::list> nodes; void touch() { modified = std::chrono::steady_clock::now(); } }; - + /// Used to ping endpoint. void ping(bi::udp::endpoint _to) const; - + /// Used ping known node. Used by node table when refreshing buckets and as part of eviction process (see evict). void ping(NodeEntry* _n) const; - + /// Returns center node entry which describes this node and used with dist() to calculate xor metric for node table nodes. NodeEntry center() const { return NodeEntry(m_node, m_node.publicKey(), m_node.endpoint.udp); } - + /// Used by asynchronous operations to return NodeEntry which is active and managed by node table. std::shared_ptr nodeEntry(NodeId _id); - + /// Used to discovery nodes on network which are close to the given target. /// Sends s_alpha concurrent requests to nodes nearest to target, for nodes nearest to target, up to s_maxSteps rounds. void discover(NodeId _target, unsigned _round = 0, std::shared_ptr>> _tried = std::shared_ptr>>()); /// Returns nodes from node table which are closest to target. std::vector> nearestNodeEntries(NodeId _target); - + /// Asynchronously drops _leastSeen node if it doesn't reply and adds _new node, otherwise _new node is thrown away. void evict(std::shared_ptr _leastSeen, std::shared_ptr _new); - + /// Called whenever activity is received from an unknown node in order to maintain node table. void noteActiveNode(Public const& _pubk, bi::udp::endpoint const& _endpoint); /// Used to drop node when timeout occurs or when evict() result is to keep previous node. void dropNode(std::shared_ptr _n); - + /// Returns references to bucket which corresponds to distance of node id. /// @warning Only use the return reference locked x_state mutex. // TODO p2p: Remove this method after removing offset-by-one functionality. NodeBucket& bucket_UNSAFE(NodeEntry const* _n); /// General Network Events - + /// Called by m_socket when packet is received. void onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytesConstRef _packet); - + /// Called by m_socket when socket is disconnected. void onDisconnected(UDPSocketFace*) {} - + /// Tasks - + /// Called by evict() to ensure eviction check is scheduled to run and terminates when no evictions remain. Asynchronous. void doCheckEvictions(boost::system::error_code const& _ec); @@ -255,7 +253,7 @@ private: void doRefreshBuckets(boost::system::error_code const& _ec); std::unique_ptr m_nodeEventHandler; ///< Event handler for node events. - + Node m_node; ///< This node. Secret m_secret; ///< This nodes secret key. @@ -312,7 +310,7 @@ struct PingNode: RLPXDatagram PingNode(bi::udp::endpoint _ep, std::string _src, uint16_t _srcPort, std::chrono::seconds _expiration = std::chrono::seconds(60)): RLPXDatagram(_ep), ipAddress(_src), port(_srcPort), expiration(futureFromEpoch(_expiration)) {} static const uint8_t type = 1; - + unsigned version = 1; std::string ipAddress; unsigned port; @@ -337,7 +335,7 @@ struct Pong: RLPXDatagram h256 echo; ///< MCD of PingNode unsigned expiration; - + void streamRLP(RLPStream& _s) const { _s.appendList(2); _s << echo << expiration; } void interpretRLP(bytesConstRef _bytes) { RLP r(_bytes); echo = (h256)r[0]; expiration = r[1].toInt(); } }; @@ -361,7 +359,7 @@ struct FindNode: RLPXDatagram FindNode(bi::udp::endpoint _ep, NodeId _target, std::chrono::seconds _expiration = std::chrono::seconds(30)): RLPXDatagram(_ep), target(_target), expiration(futureFromEpoch(_expiration)) {} static const uint8_t type = 3; - + h512 target; unsigned expiration; @@ -387,7 +385,7 @@ struct Neighbours: RLPXDatagram void streamRLP(RLPStream& _s) const { _s.appendList(3); _s << ipAddress << port << node; } void interpretRLP(RLP const& _r) { ipAddress = _r[0].toString(); port = _r[1].toInt(); node = h512(_r[2].toBytes()); } }; - + Neighbours(bi::udp::endpoint _ep): RLPXDatagram(_ep), expiration(futureFromEpoch(std::chrono::seconds(30))) {} Neighbours(bi::udp::endpoint _to, std::vector> const& _nearest, unsigned _offset = 0, unsigned _limit = 0): RLPXDatagram(_to), expiration(futureFromEpoch(std::chrono::seconds(30))) { @@ -401,7 +399,7 @@ struct Neighbours: RLPXDatagram nodes.push_back(node); } } - + static const uint8_t type = 4; std::vector nodes; unsigned expiration = 1; diff --git a/libp2p/Session.h b/libp2p/Session.h index e50202221..a5347cddb 100644 --- a/libp2p/Session.h +++ b/libp2p/Session.h @@ -28,9 +28,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include @@ -116,7 +113,7 @@ private: bool m_dropped = false; ///< If true, we've already divested ourselves of this peer. We're just waiting for the reads & writes to fail before the shared_ptr goes OOS and the destructor kicks in. PeerSessionInfo m_info; ///< Dynamic information about this peer. - + bool m_theyRequestedNodes = false; ///< Has the peer requested nodes from us without receiveing an answer from us? bool m_weRequestedNodes = false; ///< Have we requested nodes from the peer and not received an answer yet? diff --git a/libp2p/UDP.h b/libp2p/UDP.h index fdccd353e..3c3399acb 100644 --- a/libp2p/UDP.h +++ b/libp2p/UDP.h @@ -27,9 +27,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include @@ -67,7 +64,7 @@ struct RLPXDatagramFace: public UDPDatagram static uint64_t futureFromEpoch(std::chrono::milliseconds _ms) { return std::chrono::duration_cast((std::chrono::system_clock::now() + _ms).time_since_epoch()).count(); } static uint64_t futureFromEpoch(std::chrono::seconds _sec) { return std::chrono::duration_cast((std::chrono::system_clock::now() + _sec).time_since_epoch()).count(); } static Public authenticate(bytesConstRef _sig, bytesConstRef _rlp); - + virtual uint8_t packetType() = 0; RLPXDatagramFace(bi::udp::endpoint const& _ep): UDPDatagram(_ep) {} virtual h256 sign(Secret const& _from); diff --git a/libwebthree/WebThree.cpp b/libwebthree/WebThree.cpp index bf8bdc0b3..6c6414741 100644 --- a/libwebthree/WebThree.cpp +++ b/libwebthree/WebThree.cpp @@ -24,8 +24,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/libwhisper/Common.h b/libwhisper/Common.h index b6a67aa51..480b79350 100644 --- a/libwhisper/Common.h +++ b/libwhisper/Common.h @@ -24,9 +24,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/libwhisper/Interface.h b/libwhisper/Interface.h index 5956bd4cd..db595e21e 100644 --- a/libwhisper/Interface.h +++ b/libwhisper/Interface.h @@ -27,9 +27,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/libwhisper/Message.h b/libwhisper/Message.h index ff553adef..bd73df268 100644 --- a/libwhisper/Message.h +++ b/libwhisper/Message.h @@ -27,9 +27,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/libwhisper/WhisperHost.h b/libwhisper/WhisperHost.h index 7a4eb66f8..ebbbcf8ed 100644 --- a/libwhisper/WhisperHost.h +++ b/libwhisper/WhisperHost.h @@ -27,9 +27,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/libwhisper/WhisperPeer.h b/libwhisper/WhisperPeer.h index 6438b4c70..8542e987d 100644 --- a/libwhisper/WhisperPeer.h +++ b/libwhisper/WhisperPeer.h @@ -27,9 +27,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/mix/AppContext.cpp b/mix/AppContext.cpp index 187516599..29124a39a 100644 --- a/mix/AppContext.cpp +++ b/mix/AppContext.cpp @@ -22,9 +22,6 @@ * - KeyEventManager */ -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/mix/AppContext.h b/mix/AppContext.h index 7f421d7d2..268771207 100644 --- a/mix/AppContext.h +++ b/mix/AppContext.h @@ -27,9 +27,6 @@ #pragma once -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/mix/CodeEditorExtensionManager.cpp b/mix/CodeEditorExtensionManager.cpp index 86d2ee587..97b808eb2 100644 --- a/mix/CodeEditorExtensionManager.cpp +++ b/mix/CodeEditorExtensionManager.cpp @@ -20,9 +20,6 @@ * Ethereum IDE client. */ -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/mix/DebuggingStateWrapper.h b/mix/DebuggingStateWrapper.h index 2645e8c5a..7a34d6493 100644 --- a/mix/DebuggingStateWrapper.h +++ b/mix/DebuggingStateWrapper.h @@ -22,6 +22,9 @@ #pragma once +// Make sure boost/asio.hpp is included before windows.h. +#include + #include #include #include diff --git a/mix/Extension.cpp b/mix/Extension.cpp index 6795593dc..eae842279 100644 --- a/mix/Extension.cpp +++ b/mix/Extension.cpp @@ -22,9 +22,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include "Extension.h" diff --git a/mix/Extension.h b/mix/Extension.h index c2b498ce3..98daf2918 100644 --- a/mix/Extension.h +++ b/mix/Extension.h @@ -19,9 +19,6 @@ #pragma once -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include diff --git a/mix/QContractDefinition.cpp b/mix/QContractDefinition.cpp index 725d351fc..27779ce11 100644 --- a/mix/QContractDefinition.cpp +++ b/mix/QContractDefinition.cpp @@ -21,9 +21,6 @@ #include -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/neth/main.cpp b/neth/main.cpp index 844a29c87..8228f2770 100644 --- a/neth/main.cpp +++ b/neth/main.cpp @@ -26,8 +26,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 16f0d6d10..82add295e 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -24,8 +24,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/test/TestHelper.h b/test/TestHelper.h index 40294b034..6f9143c5c 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -23,8 +23,6 @@ #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include "JsonSpiritHeaders.h" diff --git a/test/checkRandomTest.cpp b/test/checkRandomTest.cpp index f1daaecbf..e3442d438 100644 --- a/test/checkRandomTest.cpp +++ b/test/checkRandomTest.cpp @@ -20,9 +20,6 @@ * Check a random test and return 0/1 for success or failure. To be used for efficiency in the random test simulation. */ -// Make sure boost/asio.hpp is included before windows.h. -#include - #include #include #include diff --git a/test/createRandomTest.cpp b/test/createRandomTest.cpp index 140a7fb38..55e023759 100644 --- a/test/createRandomTest.cpp +++ b/test/createRandomTest.cpp @@ -24,8 +24,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/test/fork.cpp b/test/fork.cpp index 65c5dd3b5..a2eb6f4eb 100644 --- a/test/fork.cpp +++ b/test/fork.cpp @@ -20,8 +20,6 @@ * Tests for different forking behavior */ -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/test/genesis.cpp b/test/genesis.cpp index a450b79fc..5ac3ea2a8 100644 --- a/test/genesis.cpp +++ b/test/genesis.cpp @@ -23,8 +23,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include "JsonSpiritHeaders.h" @@ -44,7 +42,7 @@ BOOST_AUTO_TEST_CASE(emptySHA3Types) { h256 emptyListSHA3(fromHex("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347")); BOOST_REQUIRE_EQUAL(emptyListSHA3, EmptyListSHA3); - + h256 emptySHA3(fromHex("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")); BOOST_REQUIRE_EQUAL(emptySHA3, EmptySHA3); } diff --git a/test/hexPrefix.cpp b/test/hexPrefix.cpp index 5875d62f6..da294ba5b 100644 --- a/test/hexPrefix.cpp +++ b/test/hexPrefix.cpp @@ -22,8 +22,6 @@ #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include "JsonSpiritHeaders.h" diff --git a/test/net.cpp b/test/net.cpp index fafcc1ff6..831c283e2 100644 --- a/test/net.cpp +++ b/test/net.cpp @@ -19,8 +19,6 @@ * @date 2014 */ -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include @@ -192,22 +190,22 @@ BOOST_AUTO_TEST_CASE(kademlia) node.populateAll(); clog << "NodeTable:\n" << *node.nodeTable.get() << endl; - + auto nodes = node.nodeTable->nodes(); nodes.sort(); - + node.nodeTable->reset(); clog << "NodeTable:\n" << *node.nodeTable.get() << endl; node.populate(1); clog << "NodeTable:\n" << *node.nodeTable.get() << endl; - + node.nodeTable->discover(); this_thread::sleep_for(chrono::milliseconds(2000)); clog << "NodeTable:\n" << *node.nodeTable.get() << endl; BOOST_REQUIRE_EQUAL(node.nodeTable->count(), 8); - + auto netNodes = node.nodeTable->nodes(); netNodes.sort(); diff --git a/test/rlp.cpp b/test/rlp.cpp index fc4f858ed..9062b54f4 100644 --- a/test/rlp.cpp +++ b/test/rlp.cpp @@ -23,8 +23,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/test/state.cpp b/test/state.cpp index e2201f241..17ebe2b77 100644 --- a/test/state.cpp +++ b/test/state.cpp @@ -20,8 +20,6 @@ * State test functions. */ -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/test/trie.cpp b/test/trie.cpp index 312749752..dd335b4a6 100644 --- a/test/trie.cpp +++ b/test/trie.cpp @@ -23,8 +23,6 @@ #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include "JsonSpiritHeaders.h" diff --git a/test/txTest.cpp b/test/txTest.cpp index 3f67c0a2f..e2a16e16c 100644 --- a/test/txTest.cpp +++ b/test/txTest.cpp @@ -20,8 +20,6 @@ * Simple peer transaction send test. */ -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/test/vm.cpp b/test/vm.cpp index 00ba82aaf..e78753e6a 100644 --- a/test/vm.cpp +++ b/test/vm.cpp @@ -22,8 +22,6 @@ #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/test/vm.h b/test/vm.h index 03b3b4e5e..f27bce50b 100644 --- a/test/vm.h +++ b/test/vm.h @@ -26,8 +26,6 @@ along with cpp-ethereum. If not, see . #include #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include diff --git a/test/whisperTopic.cpp b/test/whisperTopic.cpp index 0937ab922..0ea681b67 100644 --- a/test/whisperTopic.cpp +++ b/test/whisperTopic.cpp @@ -20,8 +20,6 @@ */ #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include @@ -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)); diff --git a/third/MainWin.cpp b/third/MainWin.cpp index c91c416d8..210fabe47 100644 --- a/third/MainWin.cpp +++ b/third/MainWin.cpp @@ -21,8 +21,6 @@ #include -// Make sure boost/asio.hpp is included before windows.h. -#include #include #include