diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-10-21 15:18:50 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-10-21 15:18:50 -0700 |
commit | 2436e22f46b97b281e5fcf861ba091c9cb70a76f (patch) | |
tree | 874024c3033711788ea0e6733f1f909c4a2e65ba /node/SocketManager.hpp | |
parent | 128a13107023075a8167bfdfb8ed9d404bd1dccd (diff) | |
download | infinitytier-2436e22f46b97b281e5fcf861ba091c9cb70a76f.tar.gz infinitytier-2436e22f46b97b281e5fcf861ba091c9cb70a76f.zip |
More work on abstracting socket manager.
Diffstat (limited to 'node/SocketManager.hpp')
-rw-r--r-- | node/SocketManager.hpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/node/SocketManager.hpp b/node/SocketManager.hpp index 3ac53e3d..29cc94bf 100644 --- a/node/SocketManager.hpp +++ b/node/SocketManager.hpp @@ -48,9 +48,7 @@ namespace ZeroTier { class SocketManager : NonCopyable { public: - SocketManager(void (*packetHandler)(const SharedPtr<Socket> &,void *,const InetAddress &,Buffer<ZT_SOCKET_MAX_MESSAGE_LEN> &),void *arg) : - _packetHandler(packetHandler), - _arg(arg) {} + SocketManager() {} virtual ~SocketManager() {} /** @@ -87,8 +85,13 @@ public: * If called concurrently, one will block until the other completes. * * @param timeout Timeout in milliseconds, may return sooner if whack() is called + * @param handler Packet data handler + * @param arg Void argument to packet data handler */ - virtual void poll(unsigned long timeout) = 0; + virtual void poll( + unsigned long timeout, + void (*handler)(const SharedPtr<Socket> &,void *,const InetAddress &,Buffer<ZT_SOCKET_MAX_MESSAGE_LEN> &), + void *arg); /** * Cause current or next blocking poll() operation to timeout immediately @@ -99,10 +102,6 @@ public: * Close TCP sockets */ virtual void closeTcpSockets() = 0; - -protected: - void (*_packetHandler)(const SharedPtr<Socket> &,void *,const InetAddress &,Buffer<ZT_SOCKET_MAX_MESSAGE_LEN> &); - void *_arg; }; } // namespace ZeroTier |