mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-16 10:03:14 -07:00
Refactor cluster redirects to move code to push peers out of the actual Cluster function that checks for redirect, and clean up Peer::received() to be a bit more logical.
This commit is contained in:
parent
e713f7a54c
commit
69857b4ba8
3 changed files with 66 additions and 58 deletions
|
@ -245,15 +245,22 @@ public:
|
|||
void removeMember(uint16_t memberId);
|
||||
|
||||
/**
|
||||
* Redirect this peer to a better cluster member if needed
|
||||
* Find a better cluster endpoint for this peer
|
||||
*
|
||||
* @param peer Peer to (possibly) redirect
|
||||
* @param localAddress Local address for path or NULL for none/any
|
||||
* If this endpoint appears to be the best, a NULL/0 InetAddres is returned.
|
||||
* Otherwise the InetAddress of a better endpoint is returned and the peer
|
||||
* can then then be told to contact us there.
|
||||
*
|
||||
* Redirection is only done within the same address family, so the returned
|
||||
* endpoint will always be the same ss_family as the supplied physical
|
||||
* address.
|
||||
*
|
||||
* @param peerAddress Address of peer to (possibly) redirect
|
||||
* @param peerPhysicalAddress Physical address of peer's current best path (where packet was most recently received or getBestPath()->address())
|
||||
* @param offload Always redirect if possible -- can be used to offload peers during shutdown
|
||||
* @return True if peer was redirected
|
||||
* @return InetAddress or NULL if there does not seem to be a better endpoint
|
||||
*/
|
||||
bool redirectPeer(const SharedPtr<Peer> &peer,const InetAddress &localAddress,const InetAddress &peerPhysicalAddress,bool offload);
|
||||
InetAddress findBetterEndpoint(const Address &peerAddress,const InetAddress &peerPhysicalAddress,bool offload);
|
||||
|
||||
/**
|
||||
* Fill out ZT_ClusterStatus structure (from core API)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue