mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Bump version to 0.6.4 for testing, integrate software updater auto-check into PacketDecoder decode path and main loop.
This commit is contained in:
parent
54c2c945e0
commit
c8166b2db1
5 changed files with 31 additions and 1 deletions
|
@ -340,6 +340,11 @@ error_no_byte_order_defined;
|
||||||
*/
|
*/
|
||||||
#define ZT_UPDATE_MIN_INTERVAL 120000
|
#define ZT_UPDATE_MIN_INTERVAL 120000
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum interval between attempts to do a software update
|
||||||
|
*/
|
||||||
|
#define ZT_UPDATE_MAX_INTERVAL 28800000
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update HTTP timeout in seconds
|
* Update HTTP timeout in seconds
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -434,6 +434,9 @@ Node::ReasonForTermination Node::run()
|
||||||
#ifdef ZT_AUTO_UPDATE
|
#ifdef ZT_AUTO_UPDATE
|
||||||
if (ZT_DEFAULTS.updateLatestNfoURL.length())
|
if (ZT_DEFAULTS.updateLatestNfoURL.length())
|
||||||
_r->updater = new SoftwareUpdater(_r);
|
_r->updater = new SoftwareUpdater(_r);
|
||||||
|
else {
|
||||||
|
LOG("WARNING: unable to enable software updates: latest .nfo URL from ZT_DEFAULTS is empty (does this platform actually support software updates?)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Bind local port for core I/O
|
// Bind local port for core I/O
|
||||||
|
@ -575,6 +578,8 @@ Node::ReasonForTermination Node::run()
|
||||||
_r->mc->clean();
|
_r->mc->clean();
|
||||||
_r->topology->clean();
|
_r->topology->clean();
|
||||||
_r->nc->clean();
|
_r->nc->clean();
|
||||||
|
if (_r->updater)
|
||||||
|
_r->updater->checkIfMaxIntervalExceeded(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "NodeConfig.hpp"
|
#include "NodeConfig.hpp"
|
||||||
#include "Service.hpp"
|
#include "Service.hpp"
|
||||||
#include "Demarc.hpp"
|
#include "Demarc.hpp"
|
||||||
|
#include "SoftwareUpdater.hpp"
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
|
@ -265,6 +266,11 @@ bool PacketDecoder::_doOK(const RuntimeEnvironment *_r,const SharedPtr<Peer> &pe
|
||||||
unsigned int vRevision = at<uint16_t>(ZT_PROTO_VERB_HELLO__OK__IDX_REVISION);
|
unsigned int vRevision = at<uint16_t>(ZT_PROTO_VERB_HELLO__OK__IDX_REVISION);
|
||||||
TRACE("%s(%s): OK(HELLO), version %u.%u.%u",source().toString().c_str(),_remoteAddress.toString().c_str(),vMajor,vMinor,vRevision);
|
TRACE("%s(%s): OK(HELLO), version %u.%u.%u",source().toString().c_str(),_remoteAddress.toString().c_str(),vMajor,vMinor,vRevision);
|
||||||
peer->setRemoteVersion(vMajor,vMinor,vRevision);
|
peer->setRemoteVersion(vMajor,vMinor,vRevision);
|
||||||
|
|
||||||
|
// If a supernode has a version higher than ours, this causes a software
|
||||||
|
// update check to run now.
|
||||||
|
if ((_r->updater)&&(_r->topology->isSupernode(peer->address())))
|
||||||
|
_r->updater->sawRemoteVersion(vMajor,vMinor,vRevision);
|
||||||
} break;
|
} break;
|
||||||
case Packet::VERB_WHOIS: {
|
case Packet::VERB_WHOIS: {
|
||||||
// Right now only supernodes are allowed to send OK(WHOIS) to prevent
|
// Right now only supernodes are allowed to send OK(WHOIS) to prevent
|
||||||
|
|
|
@ -76,6 +76,9 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for updates now regardless of last check time or version
|
* Check for updates now regardless of last check time or version
|
||||||
|
*
|
||||||
|
* This only starts a check if one is not in progress. Otherwise it does
|
||||||
|
* nothing.
|
||||||
*/
|
*/
|
||||||
inline void checkNow()
|
inline void checkNow()
|
||||||
{
|
{
|
||||||
|
@ -87,6 +90,17 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for updates now if it's been longer than ZT_UPDATE_MAX_INTERVAL
|
||||||
|
*
|
||||||
|
* This is called periodically from the main loop.
|
||||||
|
*/
|
||||||
|
inline void checkIfMaxIntervalExceeded(uint64_t now)
|
||||||
|
{
|
||||||
|
if ((now - _lastUpdateAttempt) >= ZT_UPDATE_MAX_INTERVAL)
|
||||||
|
checkNow();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pack three-component version into a 64-bit integer
|
* Pack three-component version into a 64-bit integer
|
||||||
*
|
*
|
||||||
|
|
|
@ -41,6 +41,6 @@
|
||||||
/**
|
/**
|
||||||
* Revision: 16-bit (0-65535)
|
* Revision: 16-bit (0-65535)
|
||||||
*/
|
*/
|
||||||
#define ZEROTIER_ONE_VERSION_REVISION 3
|
#define ZEROTIER_ONE_VERSION_REVISION 4
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue