Minor send path refactor to make packet I/O work on clusters if they are members of networks. Also fix a crash if compiled in cluster mode but no cluster is enabled.

This commit is contained in:
Adam Ierymenko 2017-02-01 12:00:25 -08:00
parent 6d5a3cd2e2
commit 5dbebc513a
5 changed files with 278 additions and 115 deletions

View file

@ -92,10 +92,10 @@ public:
* Needless to say, the packet's source must be this node. Otherwise it
* won't be encrypted right. (This is not used for relaying.)
*
* @param packet Packet to send
* @param packet Packet to send (buffer may be modified)
* @param encrypt Encrypt packet payload? (always true except for HELLO)
*/
void send(const Packet &packet,bool encrypt);
void send(Packet &packet,bool encrypt);
/**
* Request WHOIS on a given address
@ -126,7 +126,7 @@ public:
private:
Address _sendWhoisRequest(const Address &addr,const Address *peersAlreadyConsulted,unsigned int numPeersAlreadyConsulted);
bool _trySend(const Packet &packet,bool encrypt);
bool _trySend(Packet &packet,bool encrypt); // packet is modified if return is true
bool _unite(const Address &p1,const Address &p2);
const RuntimeEnvironment *const RR;