aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsubtly <subtly@users.noreply.github.com>2014-12-19 03:25:36 +0800
committersubtly <subtly@users.noreply.github.com>2014-12-19 03:25:36 +0800
commited9a5e572a8254f1595154e302f51dd242673272 (patch)
tree4c995338d465eb27c8732eef684f3e3242c3f97c
parentb3b4411c4c31d74fe0d7f5f2f85461036cac0f6e (diff)
downloaddexon-solidity-ed9a5e572a8254f1595154e302f51dd242673272.tar
dexon-solidity-ed9a5e572a8254f1595154e302f51dd242673272.tar.gz
dexon-solidity-ed9a5e572a8254f1595154e302f51dd242673272.tar.bz2
dexon-solidity-ed9a5e572a8254f1595154e302f51dd242673272.tar.lz
dexon-solidity-ed9a5e572a8254f1595154e302f51dd242673272.tar.xz
dexon-solidity-ed9a5e572a8254f1595154e302f51dd242673272.tar.zst
dexon-solidity-ed9a5e572a8254f1595154e302f51dd242673272.zip
stash
-rw-r--r--net.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/net.cpp b/net.cpp
index 0b320830..1e8d20c5 100644
--- a/net.cpp
+++ b/net.cpp
@@ -28,6 +28,21 @@ using namespace dev::p2p;
namespace ba = boost::asio;
namespace bi = ba::ip;
+class Kademlia: UDPSocketEvents
+{
+public:
+ Kademlia(): Worker("test",0), m_io(), m_socket(new UDPSocket<Kademlia, 1024>(m_io, *this, 30300)) {}
+ ~Kademlia() { m_io.stop(); stopWorking(); }
+
+ void onDisconnected(UDPSocketFace*) {};
+ void onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytesConstRef _packet) { if (_packet.toString() == "AAAA") success = true; }
+
+ ba::io_service m_io;
+ shared_ptr<UDPSocket<Kademlia, 1024>> m_socket;
+
+ bool success = false;
+};
+
class TestA: UDPSocketEvents, public Worker
{
public: