diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-17 15:14:22 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-17 15:14:22 -0700 |
commit | bd749e040d1e86f6a0aa20c64f2d69c1a21e2f24 (patch) | |
tree | 2d648d7ebe08b5aa865fb8a6071402ccfda70c22 /node/TcpSocket.hpp | |
parent | 7e80d7e551a0a2edc3fa3e6b6eb7379863c3ac04 (diff) | |
download | infinitytier-bd749e040d1e86f6a0aa20c64f2d69c1a21e2f24.tar.gz infinitytier-bd749e040d1e86f6a0aa20c64f2d69c1a21e2f24.zip |
Compile fixes.
Diffstat (limited to 'node/TcpSocket.hpp')
-rw-r--r-- | node/TcpSocket.hpp | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/node/TcpSocket.hpp b/node/TcpSocket.hpp index 0161fa27..e73d7ab3 100644 --- a/node/TcpSocket.hpp +++ b/node/TcpSocket.hpp @@ -30,17 +30,18 @@ #include <stdint.h> -#include "Socket.hpp" +#include "InetAddress.hpp" #include "Mutex.hpp" #include "Utils.hpp" +#include "Socket.hpp" + +#define ZT_TCP_SENDQ_LENGTH 4096 +#define ZT_TCP_MAX_MESSAGE_LENGTH 2048 namespace ZeroTier { class SocketManager; -#define ZT_TCP_SENDQ_LENGTH 16384 -#define ZT_TCP_MAX_MESSAGE_LENGTH 2048 - /** * A TCP socket encapsulating ZeroTier packets over a TCP stream connection * @@ -69,35 +70,26 @@ class TcpSocket : public Socket public: virtual ~TcpSocket(); - - virtual bool isOpen() const; virtual bool send(const InetAddress &to,const void *msg,unsigned int msglen); - /** - * @return Remote TCP endpoint address - */ - inline const InetAddress &remote() const { return _remote; } - protected: - virtual bool notifyAvailableForRead(const SharedPtr<Socket> &self,SocketManager *sm); - virtual bool notifyAvailableForWrite(const SharedPtr<Socket> &self,SocketManager *sm); - -private: #ifdef __WINDOWS__ - TcpSocket(SOCKET sock,bool connecting,const InetAddress &remote) : -#endif - TcpSocket(int sock,bool connecting,const InetAddress &remote) : + TcpSocket(SOCKET s,bool c,const InetAddress &r) : #else - Socket(ZT_SOCKET_TYPE_TCP,sock), + TcpSocket(int s,bool c,const InetAddress &r) : +#endif + Socket(Socket::ZT_SOCKET_TYPE_TCP,s), _lastReceivedData(Utils::now()), _inptr(0), _outptr(0), - _connecting(connecting), - _remote(remote), - _lock() - { - } + _connecting(c), + _remote(r), + _lock() {} + virtual bool notifyAvailableForRead(const SharedPtr<Socket> &self,SocketManager *sm); + virtual bool notifyAvailableForWrite(const SharedPtr<Socket> &self,SocketManager *sm); + +private: unsigned char _outbuf[ZT_TCP_SENDQ_LENGTH]; unsigned char _inbuf[ZT_TCP_MAX_MESSAGE_LENGTH]; uint64_t _lastReceivedData; // updated whenever data is received, checked directly by SocketManager for stale TCP cleanup @@ -108,6 +100,6 @@ private: Mutex _lock; }; -}; // namespace ZeroTier +} // namespace ZeroTier #endif |