summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-07 16:37:36 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-07 16:37:36 -0800
commit60731e6d02c4ebeb0700bc1c6a53261159049e01 (patch)
tree6cffdd1139cc0ecc25e9fc62ac794e9091b3d4c3
parentc1256fff5b0c09359531fc09bc8235c6f11c800d (diff)
downloadinfinitytier-60731e6d02c4ebeb0700bc1c6a53261159049e01.tar.gz
infinitytier-60731e6d02c4ebeb0700bc1c6a53261159049e01.zip
Update URLs for auto-update, check supernode version in one more place, delete pid before executing updater.
-rw-r--r--main.cpp12
-rw-r--r--node/Defaults.cpp11
-rw-r--r--node/PacketDecoder.cpp5
3 files changed, 17 insertions, 11 deletions
diff --git a/main.cpp b/main.cpp
index dfb00fc5..88c8787e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -487,8 +487,10 @@ int main(int argc,char **argv)
case Node::NODE_RESTART_FOR_UPGRADE: {
#ifdef __UNIX_LIKE__
const char *upgPath = node->reasonForTermination();
- if (upgPath)
- execl(upgPath,upgPath,"-s",(char *)0); // -s = (re)start after install/upgrade
+ if (upgPath) {
+ Utils::rm((std::string(homeDir)+"/zerotier-one.pid").c_str());
+ execl(upgPath,upgPath,(char *)0);
+ }
exitCode = 2;
fprintf(stderr,"%s: abnormal termination: unable to execute update at %s\n",argv[0],(upgPath) ? upgPath : "(unknown path)");
#endif
@@ -506,11 +508,7 @@ int main(int argc,char **argv)
} catch ( ... ) {}
#ifdef __UNIX_LIKE__
- {
- char pidpath[4096];
- Utils::snprintf(pidpath,sizeof(pidpath),"%s/zerotier-one.pid",homeDir);
- Utils::rm(pidpath);
- }
+ Utils::rm((std::string(homeDir)+"/zerotier-one.pid").c_str());
#endif
return exitCode;
diff --git a/node/Defaults.cpp b/node/Defaults.cpp
index 2588c85f..41ff540b 100644
--- a/node/Defaults.cpp
+++ b/node/Defaults.cpp
@@ -126,16 +126,19 @@ static inline const char *_mkUpdateUrl()
{
#if defined(__LINUX__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) )
if (sizeof(void *) == 8)
- return "http://download.zerotier.com/update/linux/x64/latest.nfo";
- else return "http://download.zerotier.com/update/linux/x86/latest.nfo";
+ return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x64-LATEST.nfo";
+ else return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x86-LATEST.nfo";
#define GOT_UPDATE_URL
#endif
#ifdef __APPLE__
- // TODO: iOS?
- return "http://download.zerotier.com/update/mac/combined/latest.nfo";
+#ifdef TARGET_OS_IPHONE
+ // TODO
+#else
+ return "http://download.zerotier.com/ZeroTierOneInstaller-mac-combined-LATEST.nfo";
#define GOT_UPDATE_URL
#endif
+#endif
// TODO: Windows
diff --git a/node/PacketDecoder.cpp b/node/PacketDecoder.cpp
index cf1b5ff5..b8bdc8de 100644
--- a/node/PacketDecoder.cpp
+++ b/node/PacketDecoder.cpp
@@ -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->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);
outp.append((unsigned char)Packet::VERB_HELLO);
outp.append(packetId());