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

@ -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,const void *msg,unsigned int msglen);
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
*/
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