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.

This commit is contained in:
Adam Ierymenko 2014-03-31 22:23:55 -07:00
parent 595b386afc
commit f13493edb2
11 changed files with 147 additions and 110 deletions

View file

@ -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
*