mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 04:53:44 +02:00
Tweak some timings and stuff.
This commit is contained in:
parent
c96d3ebf8c
commit
158002d2d1
4 changed files with 22 additions and 18 deletions
|
@ -273,7 +273,7 @@ error_no_byte_order_defined;
|
||||||
* This should be lower than the UDP conversation entry timeout in most
|
* This should be lower than the UDP conversation entry timeout in most
|
||||||
* stateful firewalls.
|
* stateful firewalls.
|
||||||
*/
|
*/
|
||||||
#define ZT_FIREWALL_OPENER_DELAY 50000
|
#define ZT_FIREWALL_OPENER_DELAY 30000
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delay between requests for updated network autoconf information
|
* 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.
|
* 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
|
* Activity timeout for links
|
||||||
|
|
|
@ -598,12 +598,12 @@ Node::ReasonForTermination Node::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resynchronize) {
|
if (resynchronize) {
|
||||||
/* If resynchronizing, forget P2P links to all peers and then send
|
/* Send NOP to all peers on resynchronize, directly to supernodes and
|
||||||
* something to formerly active ones. This will relay via a supernode
|
* indirectly to regular nodes (to trigger RENDEZVOUS). Also clear
|
||||||
* which will trigger a new RENDEZVOUS and a new hole punch. This
|
* learned paths since they're likely no longer valid, and close
|
||||||
* functor excludes supernodes, which are pinged separately above. */
|
* TCP sockets since they're also likely invalid. */
|
||||||
_r->topology->eachPeer(Topology::ResetActivePeers(_r,now));
|
|
||||||
_r->sm->closeTcpSockets();
|
_r->sm->closeTcpSockets();
|
||||||
|
_r->topology->eachPeer(Topology::ResetActivePeers(_r,now));
|
||||||
} else {
|
} else {
|
||||||
/* Periodically check for changes in our local multicast subscriptions
|
/* Periodically check for changes in our local multicast subscriptions
|
||||||
* and broadcast those changes to directly connected peers. */
|
* 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",
|
Utils::snprintf(tmp,sizeof(tmp),"%s;%s;%lld;%lld;%lld;%lld;%s",
|
||||||
t,
|
t,
|
||||||
_addr.toString().c_str(),
|
_addr.toString().c_str(),
|
||||||
(long long)((_lastSend != 0) ? (now - _lastSend) : -1),
|
(long long)((_lastSend != 0) ? ((now - _lastSend) / 1000LL) : -1),
|
||||||
(long long)((_lastReceived != 0) ? (now - _lastReceived) : -1),
|
(long long)((_lastReceived != 0) ? ((now - _lastReceived) / 1000LL) : -1),
|
||||||
(long long)((_lastFirewallOpener != 0) ? (now - _lastFirewallOpener) : -1),
|
(long long)((_lastFirewallOpener != 0) ? ((now - _lastFirewallOpener) / 1000LL) : -1),
|
||||||
(long long)((_lastPing != 0) ? (now - _lastPing) : -1),
|
(long long)((_lastPing != 0) ? ((now - _lastPing) / 1000LL) : -1),
|
||||||
((_fixed) ? "fixed" : (active(now) ? "active" : "inactive"))
|
((_fixed) ? "fixed" : (active(now) ? "active" : "inactive"))
|
||||||
);
|
);
|
||||||
return std::string(tmp);
|
return std::string(tmp);
|
||||||
|
|
|
@ -272,8 +272,6 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function object to forget direct links to active peers and then ping them indirectly
|
* Function object to forget direct links to active peers and then ping them indirectly
|
||||||
*
|
|
||||||
* Note that this excludes supernodes.
|
|
||||||
*/
|
*/
|
||||||
class ResetActivePeers
|
class ResetActivePeers
|
||||||
{
|
{
|
||||||
|
@ -286,12 +284,18 @@ public:
|
||||||
|
|
||||||
inline void operator()(Topology &t,const SharedPtr<Peer> &p)
|
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
|
||||||
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);
|
Packet outp(p->address(),_r->identity.address(),Packet::VERB_NOP);
|
||||||
outp.armor(p->key(),false); // no need to encrypt a 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());
|
||||||
_supernode->send(_r,outp.data(),outp.size(),_now);
|
_supernode->send(_r,outp.data(),outp.size(),_now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue