mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-18 10:46:33 +00:00
Update URLs for auto-update, check supernode version in one more place, delete pid before executing updater.
This commit is contained in:
parent
c1256fff5b
commit
60731e6d02
12
main.cpp
12
main.cpp
@ -487,8 +487,10 @@ int main(int argc,char **argv)
|
|||||||
case Node::NODE_RESTART_FOR_UPGRADE: {
|
case Node::NODE_RESTART_FOR_UPGRADE: {
|
||||||
#ifdef __UNIX_LIKE__
|
#ifdef __UNIX_LIKE__
|
||||||
const char *upgPath = node->reasonForTermination();
|
const char *upgPath = node->reasonForTermination();
|
||||||
if (upgPath)
|
if (upgPath) {
|
||||||
execl(upgPath,upgPath,"-s",(char *)0); // -s = (re)start after install/upgrade
|
Utils::rm((std::string(homeDir)+"/zerotier-one.pid").c_str());
|
||||||
|
execl(upgPath,upgPath,(char *)0);
|
||||||
|
}
|
||||||
exitCode = 2;
|
exitCode = 2;
|
||||||
fprintf(stderr,"%s: abnormal termination: unable to execute update at %s\n",argv[0],(upgPath) ? upgPath : "(unknown path)");
|
fprintf(stderr,"%s: abnormal termination: unable to execute update at %s\n",argv[0],(upgPath) ? upgPath : "(unknown path)");
|
||||||
#endif
|
#endif
|
||||||
@ -506,11 +508,7 @@ int main(int argc,char **argv)
|
|||||||
} catch ( ... ) {}
|
} catch ( ... ) {}
|
||||||
|
|
||||||
#ifdef __UNIX_LIKE__
|
#ifdef __UNIX_LIKE__
|
||||||
{
|
Utils::rm((std::string(homeDir)+"/zerotier-one.pid").c_str());
|
||||||
char pidpath[4096];
|
|
||||||
Utils::snprintf(pidpath,sizeof(pidpath),"%s/zerotier-one.pid",homeDir);
|
|
||||||
Utils::rm(pidpath);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return exitCode;
|
return exitCode;
|
||||||
|
@ -126,15 +126,18 @@ static inline const char *_mkUpdateUrl()
|
|||||||
{
|
{
|
||||||
#if defined(__LINUX__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) )
|
#if defined(__LINUX__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) )
|
||||||
if (sizeof(void *) == 8)
|
if (sizeof(void *) == 8)
|
||||||
return "http://download.zerotier.com/update/linux/x64/latest.nfo";
|
return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x64-LATEST.nfo";
|
||||||
else return "http://download.zerotier.com/update/linux/x86/latest.nfo";
|
else return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x86-LATEST.nfo";
|
||||||
#define GOT_UPDATE_URL
|
#define GOT_UPDATE_URL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// TODO: iOS?
|
#ifdef TARGET_OS_IPHONE
|
||||||
return "http://download.zerotier.com/update/mac/combined/latest.nfo";
|
// TODO
|
||||||
|
#else
|
||||||
|
return "http://download.zerotier.com/ZeroTierOneInstaller-mac-combined-LATEST.nfo";
|
||||||
#define GOT_UPDATE_URL
|
#define GOT_UPDATE_URL
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: Windows
|
// TODO: Windows
|
||||||
|
@ -253,6 +253,11 @@ bool PacketDecoder::_doHELLO(const RuntimeEnvironment *_r)
|
|||||||
peer->onReceive(_r,_localPort,_remoteAddress,hops(),packetId(),Packet::VERB_HELLO,0,Packet::VERB_NOP,Utils::now());
|
peer->onReceive(_r,_localPort,_remoteAddress,hops(),packetId(),Packet::VERB_HELLO,0,Packet::VERB_NOP,Utils::now());
|
||||||
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);
|
||||||
|
|
||||||
Packet outp(source(),_r->identity.address(),Packet::VERB_OK);
|
Packet outp(source(),_r->identity.address(),Packet::VERB_OK);
|
||||||
outp.append((unsigned char)Packet::VERB_HELLO);
|
outp.append((unsigned char)Packet::VERB_HELLO);
|
||||||
outp.append(packetId());
|
outp.append(packetId());
|
||||||
|
Loading…
Reference in New Issue
Block a user