Browse Source

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.

cl-refactor
jhuntley 10 years ago
parent
commit
6d62e3ab26
  1. 3
      alethzero/MainWin.h
  2. 1
      alethzero/OurWebThreeStubServer.h
  3. 3
      alethzero/Transact.cpp
  4. 2
      eth/main.cpp
  5. 3
      libethereum/All.h
  6. 2
      libethereum/Client.h
  7. 3
      libethereum/EthereumHost.h
  8. 2
      libp2p/Host.cpp
  9. 3
      libp2p/Host.h
  10. 2
      libp2p/Network.cpp
  11. 84
      libp2p/NodeTable.h
  12. 5
      libp2p/Session.h
  13. 5
      libp2p/UDP.h
  14. 2
      libwebthree/WebThree.cpp
  15. 3
      libwhisper/Common.h
  16. 3
      libwhisper/Interface.h
  17. 3
      libwhisper/Message.h
  18. 3
      libwhisper/WhisperHost.h
  19. 3
      libwhisper/WhisperPeer.h
  20. 3
      mix/AppContext.cpp
  21. 3
      mix/AppContext.h
  22. 3
      mix/CodeEditorExtensionManager.cpp
  23. 3
      mix/DebuggingStateWrapper.h
  24. 3
      mix/Extension.cpp
  25. 3
      mix/Extension.h
  26. 3
      mix/QContractDefinition.cpp
  27. 2
      neth/main.cpp
  28. 2
      test/TestHelper.cpp
  29. 2
      test/TestHelper.h
  30. 3
      test/checkRandomTest.cpp
  31. 2
      test/createRandomTest.cpp
  32. 2
      test/fork.cpp
  33. 4
      test/genesis.cpp
  34. 2
      test/hexPrefix.cpp
  35. 10
      test/net.cpp
  36. 2
      test/rlp.cpp
  37. 2
      test/state.cpp
  38. 2
      test/trie.cpp
  39. 2
      test/txTest.cpp
  40. 2
      test/vm.cpp
  41. 2
      test/vm.h
  42. 32
      test/whisperTopic.cpp
  43. 2
      third/MainWin.cpp

3
alethzero/MainWin.h

@ -27,9 +27,6 @@
#include <map> #include <map>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkAccessManager>
#include <QtCore/QAbstractListModel> #include <QtCore/QAbstractListModel>
#include <QtCore/QMutex> #include <QtCore/QMutex>

1
alethzero/OurWebThreeStubServer.h

@ -20,7 +20,6 @@
*/ */
#include <queue> #include <queue>
#include <boost/asio.hpp>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <libdevcore/Guards.h> #include <libdevcore/Guards.h>
#include <libethcore/CommonJS.h> #include <libethcore/CommonJS.h>

3
alethzero/Transact.cpp

@ -19,6 +19,9 @@
* @date 2015 * @date 2015
*/ */
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include "Transact.h" #include "Transact.h"
#include <fstream> #include <fstream>

2
eth/main.cpp

@ -26,8 +26,6 @@
#include <iostream> #include <iostream>
#include <signal.h> #include <signal.h>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim_all.hpp> #include <boost/algorithm/string/trim_all.hpp>

3
libethereum/All.h

@ -1,8 +1,5 @@
#pragma once #pragma once
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include "Account.h" #include "Account.h"
#include "CanonBlockChain.h" #include "CanonBlockChain.h"
#include "Client.h" #include "Client.h"

2
libethereum/Client.h

@ -28,8 +28,6 @@
#include <string> #include <string>
#include <array> #include <array>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>

3
libethereum/EthereumHost.h

@ -29,9 +29,6 @@
#include <utility> #include <utility>
#include <thread> #include <thread>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libdevcore/Guards.h> #include <libdevcore/Guards.h>
#include <libdevcore/Worker.h> #include <libdevcore/Worker.h>
#include <libdevcore/RangeMask.h> #include <libdevcore/RangeMask.h>

2
libp2p/Host.cpp

@ -25,8 +25,6 @@
#include <thread> #include <thread>
#include <mutex> #include <mutex>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>

3
libp2p/Host.h

@ -31,9 +31,6 @@
#include <thread> #include <thread>
#include <chrono> #include <chrono>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libdevcore/Guards.h> #include <libdevcore/Guards.h>
#include <libdevcore/Worker.h> #include <libdevcore/Worker.h>
#include <libdevcore/RangeMask.h> #include <libdevcore/RangeMask.h>

2
libp2p/Network.cpp

@ -26,8 +26,6 @@
#include <ifaddrs.h> #include <ifaddrs.h>
#endif #endif
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>

84
libp2p/NodeTable.h

@ -24,8 +24,6 @@
#include <algorithm> #include <algorithm>
#include <deque> #include <deque>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/integer/static_log2.hpp> #include <boost/integer/static_log2.hpp>
#include <libp2p/UDP.h> #include <libp2p/UDP.h>
@ -58,7 +56,7 @@ class NodeTableEventHandler
friend class NodeTable; friend class NodeTable;
public: public:
virtual void processEvent(NodeId const& _n, NodeTableEventType const& _e) = 0; virtual void processEvent(NodeId const& _n, NodeTableEventType const& _e) = 0;
protected: protected:
/// Called by NodeTable on behalf of an implementation (Host) to process new events without blocking nodetable. /// Called by NodeTable on behalf of an implementation (Host) to process new events without blocking nodetable.
void processEvents() void processEvents()
@ -77,10 +75,10 @@ protected:
for (auto const& e: events) for (auto const& e: events)
processEvent(e.first, e.second); processEvent(e.first, e.second);
} }
/// Called by NodeTable to append event. /// 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; } virtual void appendEvent(NodeId _n, NodeTableEventType _e) { Guard l(x_events); m_nodeEventHandler.push_back(_n); m_events[_n] = _e; }
Mutex x_events; Mutex x_events;
std::list<NodeId> m_nodeEventHandler; std::list<NodeId> m_nodeEventHandler;
std::map<NodeId, NodeTableEventType> m_events; std::map<NodeId, NodeTableEventType> m_events;
@ -88,10 +86,10 @@ protected:
class NodeTable; class NodeTable;
inline std::ostream& operator<<(std::ostream& _out, NodeTable const& _nodeTable); inline std::ostream& operator<<(std::ostream& _out, NodeTable const& _nodeTable);
/** /**
* NodeTable using modified kademlia for node discovery and preference. * 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 * UDP messages and implements a kademlia-like protocol. Node requests and
* responses are used to build a node table which can be queried to * 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 * 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<NodeTable>
using NodeSocket = UDPSocket<NodeTable, 1280>; using NodeSocket = UDPSocket<NodeTable, 1280>;
using TimePoint = std::chrono::steady_clock::time_point; using TimePoint = std::chrono::steady_clock::time_point;
using EvictionTimeout = std::pair<std::pair<NodeId, TimePoint>, NodeId>; ///< First NodeId may be evicted and replaced with second NodeId. using EvictionTimeout = std::pair<std::pair<NodeId, TimePoint>, NodeId>; ///< First NodeId may be evicted and replaced with second NodeId.
public: public:
NodeTable(ba::io_service& _io, KeyPair _alias, uint16_t _udpPort = 30303); NodeTable(ba::io_service& _io, KeyPair _alias, uint16_t _udpPort = 30303);
~NodeTable(); ~NodeTable();
/// Returns distance based on xor metric two node ids. Used by NodeEntry and 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; } 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. /// Set event handler for NodeEntryAdded and NodeEntryRemoved events.
void setEventHandler(NodeTableEventHandler* _handler) { m_nodeEventHandler.reset(_handler); } 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. /// Called by implementation which provided handler to process NodeEntryAdded/NodeEntryRemoved events. Events are coalesced by type whereby old events are ignored.
void processEvents(); void processEvents();
/// Add node. Node will be pinged if it's not already known. /// Add node. Node will be pinged if it's not already known.
std::shared_ptr<NodeEntry> addNode(Public const& _pubk, bi::udp::endpoint const& _udp, bi::tcp::endpoint const& _tcp); std::shared_ptr<NodeEntry> 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. /// Add node. Node will be pinged if it's not already known.
std::shared_ptr<NodeEntry> addNode(Node const& _node); std::shared_ptr<NodeEntry> 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. /// 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(); void discover();
/// Returns list of node ids active in node table. /// Returns list of node ids active in node table.
std::list<NodeId> nodes() const; std::list<NodeId> nodes() const;
/// Returns node count. /// Returns node count.
unsigned count() const { return m_nodes.size(); } unsigned count() const { return m_nodes.size(); }
/// Returns snapshot of table. /// Returns snapshot of table.
std::list<NodeEntry> snapshot() const; std::list<NodeEntry> snapshot() const;
/// Returns true if node id is in node table. /// Returns true if node id is in node table.
bool haveNode(NodeId const& _id) { Guard l(x_nodes); return m_nodes.count(_id) > 0; } 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. /// Returns the Node to the corresponding node id or the empty Node if that id is not found.
Node node(NodeId const& _id); Node node(NodeId const& _id);
#if defined(BOOST_AUTO_TEST_SUITE) || defined(_MSC_VER) // MSVC includes access specifier in symbol name #if defined(BOOST_AUTO_TEST_SUITE) || defined(_MSC_VER) // MSVC includes access specifier in symbol name
protected: protected:
#else #else
private: private:
#endif #endif
/// Constants for Kademlia, derived from address space. /// Constants for Kademlia, derived from address space.
static unsigned const s_addressByteSize = sizeof(NodeId); ///< Size of address type in bytes. 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_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_bins = s_bits - 1; ///< Size of m_state (excludes root, which is us).
static unsigned const s_maxSteps = boost::static_log2<s_bits>::value; ///< Max iterations of discovery. (discover) static unsigned const s_maxSteps = boost::static_log2<s_bits>::value; ///< Max iterations of discovery. (discover)
/// Chosen constants /// Chosen constants
static unsigned const s_bucketSize = 16; ///< Denoted by k in [Kademlia]. Number of nodes stored in each bucket. 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. static unsigned const s_alpha = 3; ///< Denoted by \alpha in [Kademlia]. Number of concurrent FindNode requests.
/// Intervals /// Intervals
/* todo: replace boost::posix_time; change constants to upper camelcase */ /* 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. 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::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] std::chrono::seconds const c_bucketRefresh = std::chrono::seconds(3600); ///< Refresh interval prevents bucket from becoming stale. [Kademlia]
struct NodeBucket struct NodeBucket
{ {
unsigned distance; unsigned distance;
@ -204,50 +202,50 @@ private:
std::list<std::weak_ptr<NodeEntry>> nodes; std::list<std::weak_ptr<NodeEntry>> nodes;
void touch() { modified = std::chrono::steady_clock::now(); } void touch() { modified = std::chrono::steady_clock::now(); }
}; };
/// Used to ping endpoint. /// Used to ping endpoint.
void ping(bi::udp::endpoint _to) const; 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). /// Used ping known node. Used by node table when refreshing buckets and as part of eviction process (see evict).
void ping(NodeEntry* _n) const; 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. /// 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); } 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. /// Used by asynchronous operations to return NodeEntry which is active and managed by node table.
std::shared_ptr<NodeEntry> nodeEntry(NodeId _id); std::shared_ptr<NodeEntry> nodeEntry(NodeId _id);
/// Used to discovery nodes on network which are close to the given target. /// 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. /// 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<std::set<std::shared_ptr<NodeEntry>>> _tried = std::shared_ptr<std::set<std::shared_ptr<NodeEntry>>>()); void discover(NodeId _target, unsigned _round = 0, std::shared_ptr<std::set<std::shared_ptr<NodeEntry>>> _tried = std::shared_ptr<std::set<std::shared_ptr<NodeEntry>>>());
/// Returns nodes from node table which are closest to target. /// Returns nodes from node table which are closest to target.
std::vector<std::shared_ptr<NodeEntry>> nearestNodeEntries(NodeId _target); std::vector<std::shared_ptr<NodeEntry>> nearestNodeEntries(NodeId _target);
/// Asynchronously drops _leastSeen node if it doesn't reply and adds _new node, otherwise _new node is thrown away. /// Asynchronously drops _leastSeen node if it doesn't reply and adds _new node, otherwise _new node is thrown away.
void evict(std::shared_ptr<NodeEntry> _leastSeen, std::shared_ptr<NodeEntry> _new); void evict(std::shared_ptr<NodeEntry> _leastSeen, std::shared_ptr<NodeEntry> _new);
/// Called whenever activity is received from an unknown node in order to maintain node table. /// 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); 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. /// Used to drop node when timeout occurs or when evict() result is to keep previous node.
void dropNode(std::shared_ptr<NodeEntry> _n); void dropNode(std::shared_ptr<NodeEntry> _n);
/// Returns references to bucket which corresponds to distance of node id. /// Returns references to bucket which corresponds to distance of node id.
/// @warning Only use the return reference locked x_state mutex. /// @warning Only use the return reference locked x_state mutex.
// TODO p2p: Remove this method after removing offset-by-one functionality. // TODO p2p: Remove this method after removing offset-by-one functionality.
NodeBucket& bucket_UNSAFE(NodeEntry const* _n); NodeBucket& bucket_UNSAFE(NodeEntry const* _n);
/// General Network Events /// General Network Events
/// Called by m_socket when packet is received. /// Called by m_socket when packet is received.
void onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytesConstRef _packet); void onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytesConstRef _packet);
/// Called by m_socket when socket is disconnected. /// Called by m_socket when socket is disconnected.
void onDisconnected(UDPSocketFace*) {} void onDisconnected(UDPSocketFace*) {}
/// Tasks /// Tasks
/// Called by evict() to ensure eviction check is scheduled to run and terminates when no evictions remain. Asynchronous. /// 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); void doCheckEvictions(boost::system::error_code const& _ec);
@ -255,7 +253,7 @@ private:
void doRefreshBuckets(boost::system::error_code const& _ec); void doRefreshBuckets(boost::system::error_code const& _ec);
std::unique_ptr<NodeTableEventHandler> m_nodeEventHandler; ///< Event handler for node events. std::unique_ptr<NodeTableEventHandler> m_nodeEventHandler; ///< Event handler for node events.
Node m_node; ///< This node. Node m_node; ///< This node.
Secret m_secret; ///< This nodes secret key. Secret m_secret; ///< This nodes secret key.
@ -312,7 +310,7 @@ struct PingNode: RLPXDatagram<PingNode>
PingNode(bi::udp::endpoint _ep, std::string _src, uint16_t _srcPort, std::chrono::seconds _expiration = std::chrono::seconds(60)): RLPXDatagram<PingNode>(_ep), ipAddress(_src), port(_srcPort), expiration(futureFromEpoch(_expiration)) {} PingNode(bi::udp::endpoint _ep, std::string _src, uint16_t _srcPort, std::chrono::seconds _expiration = std::chrono::seconds(60)): RLPXDatagram<PingNode>(_ep), ipAddress(_src), port(_srcPort), expiration(futureFromEpoch(_expiration)) {}
static const uint8_t type = 1; static const uint8_t type = 1;
unsigned version = 1; unsigned version = 1;
std::string ipAddress; std::string ipAddress;
unsigned port; unsigned port;
@ -337,7 +335,7 @@ struct Pong: RLPXDatagram<Pong>
h256 echo; ///< MCD of PingNode h256 echo; ///< MCD of PingNode
unsigned expiration; unsigned expiration;
void streamRLP(RLPStream& _s) const { _s.appendList(2); _s << echo << 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<unsigned>(); } void interpretRLP(bytesConstRef _bytes) { RLP r(_bytes); echo = (h256)r[0]; expiration = r[1].toInt<unsigned>(); }
}; };
@ -361,7 +359,7 @@ struct FindNode: RLPXDatagram<FindNode>
FindNode(bi::udp::endpoint _ep, NodeId _target, std::chrono::seconds _expiration = std::chrono::seconds(30)): RLPXDatagram<FindNode>(_ep), target(_target), expiration(futureFromEpoch(_expiration)) {} FindNode(bi::udp::endpoint _ep, NodeId _target, std::chrono::seconds _expiration = std::chrono::seconds(30)): RLPXDatagram<FindNode>(_ep), target(_target), expiration(futureFromEpoch(_expiration)) {}
static const uint8_t type = 3; static const uint8_t type = 3;
h512 target; h512 target;
unsigned expiration; unsigned expiration;
@ -387,7 +385,7 @@ struct Neighbours: RLPXDatagram<Neighbours>
void streamRLP(RLPStream& _s) const { _s.appendList(3); _s << ipAddress << port << node; } 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<unsigned>(); node = h512(_r[2].toBytes()); } void interpretRLP(RLP const& _r) { ipAddress = _r[0].toString(); port = _r[1].toInt<unsigned>(); node = h512(_r[2].toBytes()); }
}; };
Neighbours(bi::udp::endpoint _ep): RLPXDatagram<Neighbours>(_ep), expiration(futureFromEpoch(std::chrono::seconds(30))) {} Neighbours(bi::udp::endpoint _ep): RLPXDatagram<Neighbours>(_ep), expiration(futureFromEpoch(std::chrono::seconds(30))) {}
Neighbours(bi::udp::endpoint _to, std::vector<std::shared_ptr<NodeEntry>> const& _nearest, unsigned _offset = 0, unsigned _limit = 0): RLPXDatagram<Neighbours>(_to), expiration(futureFromEpoch(std::chrono::seconds(30))) Neighbours(bi::udp::endpoint _to, std::vector<std::shared_ptr<NodeEntry>> const& _nearest, unsigned _offset = 0, unsigned _limit = 0): RLPXDatagram<Neighbours>(_to), expiration(futureFromEpoch(std::chrono::seconds(30)))
{ {
@ -401,7 +399,7 @@ struct Neighbours: RLPXDatagram<Neighbours>
nodes.push_back(node); nodes.push_back(node);
} }
} }
static const uint8_t type = 4; static const uint8_t type = 4;
std::vector<Node> nodes; std::vector<Node> nodes;
unsigned expiration = 1; unsigned expiration = 1;

5
libp2p/Session.h

@ -28,9 +28,6 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libdevcore/RLP.h> #include <libdevcore/RLP.h>
#include <libdevcore/RangeMask.h> #include <libdevcore/RangeMask.h>
@ -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. 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. 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_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? bool m_weRequestedNodes = false; ///< Have we requested nodes from the peer and not received an answer yet?

5
libp2p/UDP.h

@ -27,9 +27,6 @@
#include <deque> #include <deque>
#include <array> #include <array>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libdevcore/Guards.h> #include <libdevcore/Guards.h>
#include <libdevcrypto/Common.h> #include <libdevcrypto/Common.h>
#include <libdevcrypto/SHA3.h> #include <libdevcrypto/SHA3.h>
@ -67,7 +64,7 @@ struct RLPXDatagramFace: public UDPDatagram
static uint64_t futureFromEpoch(std::chrono::milliseconds _ms) { return std::chrono::duration_cast<std::chrono::seconds>((std::chrono::system_clock::now() + _ms).time_since_epoch()).count(); } static uint64_t futureFromEpoch(std::chrono::milliseconds _ms) { return std::chrono::duration_cast<std::chrono::seconds>((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::seconds>((std::chrono::system_clock::now() + _sec).time_since_epoch()).count(); } static uint64_t futureFromEpoch(std::chrono::seconds _sec) { return std::chrono::duration_cast<std::chrono::seconds>((std::chrono::system_clock::now() + _sec).time_since_epoch()).count(); }
static Public authenticate(bytesConstRef _sig, bytesConstRef _rlp); static Public authenticate(bytesConstRef _sig, bytesConstRef _rlp);
virtual uint8_t packetType() = 0; virtual uint8_t packetType() = 0;
RLPXDatagramFace(bi::udp::endpoint const& _ep): UDPDatagram(_ep) {} RLPXDatagramFace(bi::udp::endpoint const& _ep): UDPDatagram(_ep) {}
virtual h256 sign(Secret const& _from); virtual h256 sign(Secret const& _from);

2
libwebthree/WebThree.cpp

@ -24,8 +24,6 @@
#include <chrono> #include <chrono>
#include <thread> #include <thread>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>

3
libwhisper/Common.h

@ -24,9 +24,6 @@
#include <string> #include <string>
#include <chrono> #include <chrono>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>
#include <libdevcore/RLP.h> #include <libdevcore/RLP.h>

3
libwhisper/Interface.h

@ -27,9 +27,6 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libdevcore/RLP.h> #include <libdevcore/RLP.h>
#include <libdevcore/Guards.h> #include <libdevcore/Guards.h>
#include <libdevcrypto/SHA3.h> #include <libdevcrypto/SHA3.h>

3
libwhisper/Message.h

@ -27,9 +27,6 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libdevcore/RLP.h> #include <libdevcore/RLP.h>
#include <libdevcore/Guards.h> #include <libdevcore/Guards.h>
#include <libdevcrypto/Common.h> #include <libdevcrypto/Common.h>

3
libwhisper/WhisperHost.h

@ -27,9 +27,6 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libdevcore/RLP.h> #include <libdevcore/RLP.h>
#include <libdevcore/Worker.h> #include <libdevcore/Worker.h>
#include <libdevcore/Guards.h> #include <libdevcore/Guards.h>

3
libwhisper/WhisperPeer.h

@ -27,9 +27,6 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libdevcore/RLP.h> #include <libdevcore/RLP.h>
#include <libdevcore/Guards.h> #include <libdevcore/Guards.h>
#include <libdevcrypto/SHA3.h> #include <libdevcrypto/SHA3.h>

3
mix/AppContext.cpp

@ -22,9 +22,6 @@
* - KeyEventManager * - KeyEventManager
*/ */
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <QMessageBox> #include <QMessageBox>
#include <QClipboard> #include <QClipboard>
#include <QQmlComponent> #include <QQmlComponent>

3
mix/AppContext.h

@ -27,9 +27,6 @@
#pragma once #pragma once
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <memory> #include <memory>
#include <QUrl> #include <QUrl>
#include <QObject> #include <QObject>

3
mix/CodeEditorExtensionManager.cpp

@ -20,9 +20,6 @@
* Ethereum IDE client. * Ethereum IDE client.
*/ */
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <QQuickItem> #include <QQuickItem>
#include <QGraphicsObject> #include <QGraphicsObject>
#include <QQmlEngine> #include <QQmlEngine>

3
mix/DebuggingStateWrapper.h

@ -22,6 +22,9 @@
#pragma once #pragma once
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <QStringList> #include <QStringList>
#include <QMap> #include <QMap>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>

3
mix/Extension.cpp

@ -22,9 +22,6 @@
#include <QDebug> #include <QDebug>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libevm/VM.h> #include <libevm/VM.h>
#include <libwebthree/WebThree.h> #include <libwebthree/WebThree.h>
#include "Extension.h" #include "Extension.h"

3
mix/Extension.h

@ -19,9 +19,6 @@
#pragma once #pragma once
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <QApplication> #include <QApplication>
#include <QQmlComponent> #include <QQmlComponent>

3
mix/QContractDefinition.cpp

@ -21,9 +21,6 @@
#include <QObject> #include <QObject>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <libsolidity/CompilerStack.h> #include <libsolidity/CompilerStack.h>
#include <libsolidity/AST.h> #include <libsolidity/AST.h>
#include <libsolidity/Scanner.h> #include <libsolidity/Scanner.h>

2
neth/main.cpp

@ -26,8 +26,6 @@
#include <iostream> #include <iostream>
#include <signal.h> #include <signal.h>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim_all.hpp> #include <boost/algorithm/string/trim_all.hpp>

2
test/TestHelper.cpp

@ -24,8 +24,6 @@
#include <thread> #include <thread>
#include <chrono> #include <chrono>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <libethereum/Client.h> #include <libethereum/Client.h>

2
test/TestHelper.h

@ -23,8 +23,6 @@
#include <functional> #include <functional>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include "JsonSpiritHeaders.h" #include "JsonSpiritHeaders.h"

3
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. * 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 <boost/asio.hpp>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libdevcore/Exceptions.h> #include <libdevcore/Exceptions.h>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>

2
test/createRandomTest.cpp

@ -24,8 +24,6 @@
#include <iostream> #include <iostream>
#include <chrono> #include <chrono>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/random.hpp> #include <boost/random.hpp>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>

2
test/fork.cpp

@ -20,8 +20,6 @@
* Tests for different forking behavior * Tests for different forking behavior
*/ */
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>

4
test/genesis.cpp

@ -23,8 +23,6 @@
#include <fstream> #include <fstream>
#include <random> #include <random>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include "JsonSpiritHeaders.h" #include "JsonSpiritHeaders.h"
@ -44,7 +42,7 @@ BOOST_AUTO_TEST_CASE(emptySHA3Types)
{ {
h256 emptyListSHA3(fromHex("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347")); h256 emptyListSHA3(fromHex("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"));
BOOST_REQUIRE_EQUAL(emptyListSHA3, EmptyListSHA3); BOOST_REQUIRE_EQUAL(emptyListSHA3, EmptyListSHA3);
h256 emptySHA3(fromHex("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")); h256 emptySHA3(fromHex("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"));
BOOST_REQUIRE_EQUAL(emptySHA3, EmptySHA3); BOOST_REQUIRE_EQUAL(emptySHA3, EmptySHA3);
} }

2
test/hexPrefix.cpp

@ -22,8 +22,6 @@
#include <fstream> #include <fstream>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include "JsonSpiritHeaders.h" #include "JsonSpiritHeaders.h"

10
test/net.cpp

@ -19,8 +19,6 @@
* @date 2014 * @date 2014
*/ */
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <libdevcore/Worker.h> #include <libdevcore/Worker.h>
@ -192,22 +190,22 @@ BOOST_AUTO_TEST_CASE(kademlia)
node.populateAll(); node.populateAll();
clog << "NodeTable:\n" << *node.nodeTable.get() << endl; clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
auto nodes = node.nodeTable->nodes(); auto nodes = node.nodeTable->nodes();
nodes.sort(); nodes.sort();
node.nodeTable->reset(); node.nodeTable->reset();
clog << "NodeTable:\n" << *node.nodeTable.get() << endl; clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
node.populate(1); node.populate(1);
clog << "NodeTable:\n" << *node.nodeTable.get() << endl; clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
node.nodeTable->discover(); node.nodeTable->discover();
this_thread::sleep_for(chrono::milliseconds(2000)); this_thread::sleep_for(chrono::milliseconds(2000));
clog << "NodeTable:\n" << *node.nodeTable.get() << endl; clog << "NodeTable:\n" << *node.nodeTable.get() << endl;
BOOST_REQUIRE_EQUAL(node.nodeTable->count(), 8); BOOST_REQUIRE_EQUAL(node.nodeTable->count(), 8);
auto netNodes = node.nodeTable->nodes(); auto netNodes = node.nodeTable->nodes();
netNodes.sort(); netNodes.sort();

2
test/rlp.cpp

@ -23,8 +23,6 @@
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>

2
test/state.cpp

@ -20,8 +20,6 @@
* State test functions. * State test functions.
*/ */
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>

2
test/trie.cpp

@ -23,8 +23,6 @@
#include <fstream> #include <fstream>
#include <random> #include <random>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include "JsonSpiritHeaders.h" #include "JsonSpiritHeaders.h"

2
test/txTest.cpp

@ -20,8 +20,6 @@
* Simple peer transaction send test. * Simple peer transaction send test.
*/ */
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>

2
test/vm.cpp

@ -22,8 +22,6 @@
#include <chrono> #include <chrono>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <libethereum/Executive.h> #include <libethereum/Executive.h>

2
test/vm.h

@ -26,8 +26,6 @@ along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
#include <fstream> #include <fstream>
#include <cstdint> #include <cstdint>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <json_spirit/json_spirit.h> #include <json_spirit/json_spirit.h>

32
test/whisperTopic.cpp

@ -20,8 +20,6 @@
*/ */
#include <functional> #include <functional>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <libp2p/Host.h> #include <libp2p/Host.h>
@ -44,10 +42,10 @@ BOOST_AUTO_TEST_CASE(topic)
Host host1("Test", NetworkPreferences(30303, "127.0.0.1", false, true)); Host host1("Test", NetworkPreferences(30303, "127.0.0.1", false, true));
auto whost1 = host1.registerCapability(new WhisperHost()); auto whost1 = host1.registerCapability(new WhisperHost());
host1.start(); host1.start();
while (!host1.isStarted()) while (!host1.isStarted())
this_thread::sleep_for(chrono::milliseconds(2)); this_thread::sleep_for(chrono::milliseconds(2));
bool started = false; bool started = false;
unsigned result = 0; unsigned result = 0;
std::thread listener([&]() std::thread listener([&]()
@ -75,19 +73,19 @@ BOOST_AUTO_TEST_CASE(topic)
} }
this_thread::sleep_for(chrono::milliseconds(50)); this_thread::sleep_for(chrono::milliseconds(50));
} }
}); });
Host host2("Test", NetworkPreferences(30300, "127.0.0.1", false, true)); Host host2("Test", NetworkPreferences(30300, "127.0.0.1", false, true));
auto whost2 = host2.registerCapability(new WhisperHost()); auto whost2 = host2.registerCapability(new WhisperHost());
host2.start(); host2.start();
while (!host2.isStarted()) while (!host2.isStarted())
this_thread::sleep_for(chrono::milliseconds(2)); this_thread::sleep_for(chrono::milliseconds(2));
this_thread::sleep_for(chrono::milliseconds(100)); this_thread::sleep_for(chrono::milliseconds(100));
host2.addNode(host1.id(), "127.0.0.1", 30303, 30303); host2.addNode(host1.id(), "127.0.0.1", 30303, 30303);
this_thread::sleep_for(chrono::milliseconds(500)); this_thread::sleep_for(chrono::milliseconds(500));
while (!started) while (!started)
@ -111,7 +109,7 @@ BOOST_AUTO_TEST_CASE(forwarding)
cnote << "Testing Whisper forwarding..."; cnote << "Testing Whisper forwarding...";
auto oldLogVerbosity = g_logVerbosity; auto oldLogVerbosity = g_logVerbosity;
g_logVerbosity = 0; g_logVerbosity = 0;
// Host must be configured not to share peers. // Host must be configured not to share peers.
Host host1("Listner", NetworkPreferences(30303, "", false, true)); Host host1("Listner", NetworkPreferences(30303, "", false, true));
host1.setIdealPeerCount(0); host1.setIdealPeerCount(0);
@ -119,7 +117,7 @@ BOOST_AUTO_TEST_CASE(forwarding)
host1.start(); host1.start();
while (!host1.isStarted()) while (!host1.isStarted())
this_thread::sleep_for(chrono::milliseconds(2)); this_thread::sleep_for(chrono::milliseconds(2));
unsigned result = 0; unsigned result = 0;
bool done = false; bool done = false;
@ -146,7 +144,7 @@ BOOST_AUTO_TEST_CASE(forwarding)
} }
}); });
// Host must be configured not to share peers. // Host must be configured not to share peers.
Host host2("Forwarder", NetworkPreferences(30305, "", false, true)); Host host2("Forwarder", NetworkPreferences(30305, "", false, true));
host2.setIdealPeerCount(1); host2.setIdealPeerCount(1);
@ -154,7 +152,7 @@ BOOST_AUTO_TEST_CASE(forwarding)
host2.start(); host2.start();
while (!host2.isStarted()) while (!host2.isStarted())
this_thread::sleep_for(chrono::milliseconds(2)); this_thread::sleep_for(chrono::milliseconds(2));
Public fwderid; Public fwderid;
bool startedForwarder = false; bool startedForwarder = false;
std::thread forwarder([&]() std::thread forwarder([&]()
@ -214,7 +212,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding)
unsigned result = 0; unsigned result = 0;
bool done = false; bool done = false;
// Host must be configured not to share peers. // Host must be configured not to share peers.
Host host1("Forwarder", NetworkPreferences(30305, "", false, true)); Host host1("Forwarder", NetworkPreferences(30305, "", false, true));
host1.setIdealPeerCount(1); host1.setIdealPeerCount(1);
@ -227,7 +225,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding)
std::thread forwarder([&]() std::thread forwarder([&]()
{ {
setThreadName("forwarder"); setThreadName("forwarder");
this_thread::sleep_for(chrono::milliseconds(500)); this_thread::sleep_for(chrono::milliseconds(500));
// ph.addNode("127.0.0.1", 30303, 30303); // ph.addNode("127.0.0.1", 30303, 30303);
@ -249,7 +247,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding)
while (!startedForwarder) while (!startedForwarder)
this_thread::sleep_for(chrono::milliseconds(2)); this_thread::sleep_for(chrono::milliseconds(2));
{ {
Host host2("Sender", NetworkPreferences(30300, "", false, true)); Host host2("Sender", NetworkPreferences(30300, "", false, true));
host2.setIdealPeerCount(1); host2.setIdealPeerCount(1);
@ -261,7 +259,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding)
while (!host2.peerCount()) while (!host2.peerCount())
this_thread::sleep_for(chrono::milliseconds(5)); this_thread::sleep_for(chrono::milliseconds(5));
KeyPair us = KeyPair::create(); KeyPair us = KeyPair::create();
whost2->post(us.sec(), RLPStream().append(1).out(), BuildTopic("test")); whost2->post(us.sec(), RLPStream().append(1).out(), BuildTopic("test"));
this_thread::sleep_for(chrono::milliseconds(250)); this_thread::sleep_for(chrono::milliseconds(250));

2
third/MainWin.cpp

@ -21,8 +21,6 @@
#include <fstream> #include <fstream>
// Make sure boost/asio.hpp is included before windows.h.
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <QtNetwork/QNetworkReply> #include <QtNetwork/QNetworkReply>

Loading…
Cancel
Save