From f13493edb2aae228ddbe70cc2f0609c541faf2d7 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 31 Mar 2014 22:23:55 -0700 Subject: Oops... turns out we need to differentiate incoming from outgoing TCP and indeed learn incoming TCP paths. Otherwise the recipient of a TCP connection does not know to reply via TCP! Heh. --- node/Socket.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'node/Socket.hpp') diff --git a/node/Socket.hpp b/node/Socket.hpp index ff185e6f..3cfedb1a 100644 --- a/node/Socket.hpp +++ b/node/Socket.hpp @@ -65,7 +65,8 @@ public: { ZT_SOCKET_TYPE_UDP_V4, ZT_SOCKET_TYPE_UDP_V6, - ZT_SOCKET_TYPE_TCP + ZT_SOCKET_TYPE_TCP_IN, // incoming connection, not listen + ZT_SOCKET_TYPE_TCP_OUT }; virtual ~Socket() {} @@ -79,6 +80,15 @@ public: return _type; } + /** + * @return True if this is a TCP socket + */ + inline bool tcp() const + throw() + { + return ((_type == ZT_SOCKET_TYPE_TCP_IN)||(_type == ZT_SOCKET_TYPE_TCP_OUT)); + } + /** * Send a ZeroTier message packet * -- cgit v1.2.3