diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-05-20 19:38:49 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-05-20 19:38:49 -0700 |
| commit | 12130739166895db88dca0c230f3972bd3ac3d6a (patch) | |
| tree | ec5ce7cc4b2e804dcca69f874e58cb4f1aa6fbff /node | |
| parent | b6698d8415728a249426ee784fcbebfdfb8e4632 (diff) | |
| download | infinitytier-12130739166895db88dca0c230f3972bd3ac3d6a.tar.gz infinitytier-12130739166895db88dca0c230f3972bd3ac3d6a.zip | |
Apple auto-update stuff, now for Windows.
Diffstat (limited to 'node')
| -rw-r--r-- | node/Node.cpp | 2 | ||||
| -rw-r--r-- | node/Peer.hpp | 25 | ||||
| -rw-r--r-- | node/Utils.hpp | 27 |
3 files changed, 28 insertions, 26 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index 0e3ddd14..8eb9ae90 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -443,7 +443,7 @@ std::string Node::dataStoreGet(const char *name) void Node::postNewerVersionIfNewer(unsigned int major,unsigned int minor,unsigned int rev) { - if (Peer::compareVersion(major,minor,rev,_newestVersionSeen[0],_newestVersionSeen[1],_newestVersionSeen[2]) > 0) { + if (Utils::compareVersion(major,minor,rev,_newestVersionSeen[0],_newestVersionSeen[1],_newestVersionSeen[2]) > 0) { _newestVersionSeen[0] = major; _newestVersionSeen[1] = minor; _newestVersionSeen[2] = rev; diff --git a/node/Peer.hpp b/node/Peer.hpp index 343cfcfa..3d52761a 100644 --- a/node/Peer.hpp +++ b/node/Peer.hpp @@ -407,31 +407,6 @@ public: else return std::pair<InetAddress,InetAddress>(); } - /** - * Compare Peer version tuples - */ - static inline int compareVersion(unsigned int maj1,unsigned int min1,unsigned int rev1,unsigned int maj2,unsigned int min2,unsigned int rev2) - throw() - { - if (maj1 > maj2) - return 1; - else if (maj1 < maj2) - return -1; - else { - if (min1 > min2) - return 1; - else if (min1 < min2) - return -1; - else { - if (rev1 > rev2) - return 1; - else if (rev1 < rev2) - return -1; - else return 0; - } - } - } - private: void _announceMulticastGroups(const RuntimeEnvironment *RR,uint64_t now); diff --git a/node/Utils.hpp b/node/Utils.hpp index bdd673a9..bd567cf5 100644 --- a/node/Utils.hpp +++ b/node/Utils.hpp @@ -382,6 +382,33 @@ public: static inline int64_t ntoh(int64_t n) throw() { return (int64_t)ntoh((uint64_t)n); } /** + * Compare Peer version tuples + * + * @return -1, 0, or 1 based on whether first tuple is less than, equal to, or greater than second + */ + static inline int compareVersion(unsigned int maj1,unsigned int min1,unsigned int rev1,unsigned int maj2,unsigned int min2,unsigned int rev2) + throw() + { + if (maj1 > maj2) + return 1; + else if (maj1 < maj2) + return -1; + else { + if (min1 > min2) + return 1; + else if (min1 < min2) + return -1; + else { + if (rev1 > rev2) + return 1; + else if (rev1 < rev2) + return -1; + else return 0; + } + } + } + + /** * Hexadecimal characters 0-f */ static const char HEXCHARS[16]; |
