diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-31 22:23:55 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-31 22:23:55 -0700 |
commit | f13493edb2aae228ddbe70cc2f0609c541faf2d7 (patch) | |
tree | cb1a6845ec82e2ea361ce15e88440a249992091c /node/SocketManager.hpp | |
parent | 595b386afcd4e4eca0cf379cd14689c1db8ee647 (diff) | |
download | infinitytier-f13493edb2aae228ddbe70cc2f0609c541faf2d7.tar.gz infinitytier-f13493edb2aae228ddbe70cc2f0609c541faf2d7.zip |
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.
Diffstat (limited to 'node/SocketManager.hpp')
-rw-r--r-- | node/SocketManager.hpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/node/SocketManager.hpp b/node/SocketManager.hpp index 003c35eb..40a0c1df 100644 --- a/node/SocketManager.hpp +++ b/node/SocketManager.hpp @@ -85,17 +85,22 @@ public: /** * Send a message to a remote peer * - * If 'tcp' is true an existing TCP socket will be used or an attempt will - * be made to connect if one is not available. The message will be placed - * in the connecting TCP socket's outgoing queue, so if the connection - * succeeds the message will be sent. Otherwise it will be dropped. - * * @param to Destination address * @param tcp Use TCP? + * @param autoConnectTcp If true, automatically initiate TCP connection if there is none + * @param msg Message to send + * @param msglen Length of message + */ + bool send(const InetAddress &to,bool tcp,bool autoConnectTcp,const void *msg,unsigned int msglen); + + /** + * Send a message to a remote peer via UDP (shortcut for setting both TCP params to false in send) + * + * @param to Destination address * @param msg Message to send * @param msglen Length of message */ - bool send(const InetAddress &to,bool tcp,const void *msg,unsigned int msglen); + inline bool sendUdp(const InetAddress &to,const void *msg,unsigned int msglen) { return send(to,false,false,msg,msglen); } /** * Send a UDP packet with a limited IP TTL |