From e34bc961dbf85bb7a1d0a12637f306fe81c9aef6 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 8 Apr 2015 17:10:21 -0700 Subject: Add awareness of online status, and put old OS-dep utils in OSUtils. --- node/Node.hpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'node/Node.hpp') diff --git a/node/Node.hpp b/node/Node.hpp index 21d4567f..e16061b0 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -172,7 +172,19 @@ public: } /** - * @return Overall system level of desperation based on how long it's been since an upstream node (supernode) has talked to us + * Get an overall current level of desperation + * + * The current level of desperation is based on how recently an upstream + * (a.k.a. supernode) peer has spoken to us. As such, it will change and + * return to 0 once something like tunneling (higher desperation link) is + * active. As a result, actual link desperation for outgoing messages + * should be the max of either this or the most recent link desperation + * for an incoming message from a given address. See Path.hpp and Peer.hpp. + * + * In other words think of this as 'the desperation we should try to + * escalate to right now.' + * + * @return Overall system level of desperation */ inline unsigned int coreDesperation() const throw() { return _coreDesperation; } @@ -198,6 +210,11 @@ public: */ inline int configureVirtualNetworkPort(uint64_t nwid,ZT1_VirtualNetworkConfigOperation op,const ZT1_VirtualNetworkConfig *nc) { return _virtualNetworkConfigFunction(reinterpret_cast(this),nwid,op,nc); } + /** + * @return True if we appear to be online + */ + inline bool online() const throw() { return _online; } + /** * If this version is newer than the newest we've seen, post a new version seen event */ @@ -231,6 +248,7 @@ private: uint64_t _lastHousekeepingRun; unsigned int _coreDesperation; unsigned int _newestVersionSeen[3]; // major, minor, revision + bool _online; }; } // namespace ZeroTier -- cgit v1.2.3