mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 04:57:53 +00:00
Tweak some timings and stuff.
This commit is contained in:
parent
c96d3ebf8c
commit
158002d2d1
@ -267,13 +267,13 @@ error_no_byte_order_defined;
|
||||
*/
|
||||
#define ZT_PEER_DIRECT_PING_DELAY 120000
|
||||
|
||||
/**
|
||||
/**
|
||||
* Delay in ms between firewall opener packets to direct links
|
||||
*
|
||||
* This should be lower than the UDP conversation entry timeout in most
|
||||
* stateful firewalls.
|
||||
*/
|
||||
#define ZT_FIREWALL_OPENER_DELAY 50000
|
||||
#define ZT_FIREWALL_OPENER_DELAY 30000
|
||||
|
||||
/**
|
||||
* Delay between requests for updated network autoconf information
|
||||
@ -290,7 +290,7 @@ error_no_byte_order_defined;
|
||||
*
|
||||
* This is the shortest of the check delays/periods.
|
||||
*/
|
||||
#define ZT_MIN_SERVICE_LOOP_INTERVAL ZT_NETWORK_FINGERPRINT_CHECK_DELAY
|
||||
#define ZT_MIN_SERVICE_LOOP_INTERVAL 5000
|
||||
|
||||
/**
|
||||
* Activity timeout for links
|
||||
|
@ -598,12 +598,12 @@ Node::ReasonForTermination Node::run()
|
||||
}
|
||||
|
||||
if (resynchronize) {
|
||||
/* If resynchronizing, forget P2P links to all peers and then send
|
||||
* something to formerly active ones. This will relay via a supernode
|
||||
* which will trigger a new RENDEZVOUS and a new hole punch. This
|
||||
* functor excludes supernodes, which are pinged separately above. */
|
||||
_r->topology->eachPeer(Topology::ResetActivePeers(_r,now));
|
||||
/* Send NOP to all peers on resynchronize, directly to supernodes and
|
||||
* indirectly to regular nodes (to trigger RENDEZVOUS). Also clear
|
||||
* learned paths since they're likely no longer valid, and close
|
||||
* TCP sockets since they're also likely invalid. */
|
||||
_r->sm->closeTcpSockets();
|
||||
_r->topology->eachPeer(Topology::ResetActivePeers(_r,now));
|
||||
} else {
|
||||
/* Periodically check for changes in our local multicast subscriptions
|
||||
* and broadcast those changes to directly connected peers. */
|
||||
|
@ -133,10 +133,10 @@ public:
|
||||
Utils::snprintf(tmp,sizeof(tmp),"%s;%s;%lld;%lld;%lld;%lld;%s",
|
||||
t,
|
||||
_addr.toString().c_str(),
|
||||
(long long)((_lastSend != 0) ? (now - _lastSend) : -1),
|
||||
(long long)((_lastReceived != 0) ? (now - _lastReceived) : -1),
|
||||
(long long)((_lastFirewallOpener != 0) ? (now - _lastFirewallOpener) : -1),
|
||||
(long long)((_lastPing != 0) ? (now - _lastPing) : -1),
|
||||
(long long)((_lastSend != 0) ? ((now - _lastSend) / 1000LL) : -1),
|
||||
(long long)((_lastReceived != 0) ? ((now - _lastReceived) / 1000LL) : -1),
|
||||
(long long)((_lastFirewallOpener != 0) ? ((now - _lastFirewallOpener) / 1000LL) : -1),
|
||||
(long long)((_lastPing != 0) ? ((now - _lastPing) / 1000LL) : -1),
|
||||
((_fixed) ? "fixed" : (active(now) ? "active" : "inactive"))
|
||||
);
|
||||
return std::string(tmp);
|
||||
|
@ -272,8 +272,6 @@ public:
|
||||
|
||||
/**
|
||||
* Function object to forget direct links to active peers and then ping them indirectly
|
||||
*
|
||||
* Note that this excludes supernodes.
|
||||
*/
|
||||
class ResetActivePeers
|
||||
{
|
||||
@ -286,12 +284,18 @@ public:
|
||||
|
||||
inline void operator()(Topology &t,const SharedPtr<Peer> &p)
|
||||
{
|
||||
if (!_supernodeAddresses.count(p->address())) {
|
||||
p->clearPaths(false); // false means don't forget 'fixed' paths e.g. supernodes
|
||||
p->clearPaths(false); // false means don't forget 'fixed' paths e.g. supernodes
|
||||
|
||||
Packet outp(p->address(),_r->identity.address(),Packet::VERB_NOP);
|
||||
outp.armor(p->key(),false); // no need to encrypt a NOP
|
||||
|
||||
if (_supernodeAddresses.count(p->address())) {
|
||||
// Send NOP directly to supernodes
|
||||
p->send(_r,outp.data(),outp.size(),_now);
|
||||
} else {
|
||||
// Send NOP indirectly to regular peers if still active, triggering a new RENDEZVOUS
|
||||
if (((_now - p->lastFrame()) < ZT_PEER_PATH_ACTIVITY_TIMEOUT)&&(_supernode)) {
|
||||
TRACE("sending reset NOP to %s",p->address().toString().c_str());
|
||||
Packet outp(p->address(),_r->identity.address(),Packet::VERB_NOP);
|
||||
outp.armor(p->key(),false); // no need to encrypt a NOP
|
||||
_supernode->send(_r,outp.data(),outp.size(),_now);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user