From bd749e040d1e86f6a0aa20c64f2d69c1a21e2f24 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 17 Mar 2014 15:14:22 -0700 Subject: Compile fixes. --- node/Socket.hpp | 43 +++++++++++-------------------------------- 1 file changed, 11 insertions(+), 32 deletions(-) (limited to 'node/Socket.hpp') diff --git a/node/Socket.hpp b/node/Socket.hpp index 687834a2..e8ebfeb7 100644 --- a/node/Socket.hpp +++ b/node/Socket.hpp @@ -28,8 +28,6 @@ #ifndef ZT_SOCKET_HPP #define ZT_SOCKET_HPP -#include - #include "Constants.hpp" #include "InetAddress.hpp" #include "AtomicCounter.hpp" @@ -49,6 +47,7 @@ namespace ZeroTier { +class Socket; class SocketManager; /** @@ -58,8 +57,8 @@ class SocketManager; */ class Socket : NonCopyable { - friend class SharedPtr; friend class SocketManager; + friend class SharedPtr; public: enum Type @@ -80,20 +79,6 @@ public: return _type; } - /** - * @return True if this is a TCP socket - */ - inline bool isTCP() const - throw() - { - return (_type == ZT_SOCKET_TYPE_TCP); - } - - /** - * @return True if socket is available for sending/receiving of data - */ - virtual bool isOpen() const = 0; - /** * Send a ZeroTier message packet * @@ -105,25 +90,19 @@ public: virtual bool send(const InetAddress &to,const void *msg,unsigned int msglen) = 0; protected: +#ifdef __WINDOWS__ + Socket(Type t,SOCKET s) : +#else + Socket(Type t,int s) : +#endif + _sock(s), + _type(t) {} + // Called only by SocketManager, should return false if socket is no longer open/valid (e.g. connection drop or other fatal error) virtual bool notifyAvailableForRead(const SharedPtr &self,SocketManager *sm) = 0; virtual bool notifyAvailableForWrite(const SharedPtr &self,SocketManager *sm) = 0; private: -#ifdef __WINDOWS__ - Socket(Type t,SOCKET sock) : - _sock(sock), - _type(t) - { - } -#else - Socket(Type t,int sock) : - _sock(sock), - _type(t) - { - } -#endif - #ifdef __WINDOWS__ SOCKET _sock; #else @@ -134,6 +113,6 @@ private: AtomicCounter __refCount; }; -}; // namespace ZeroTier +} // namespace ZeroTier #endif -- cgit v1.2.3