summaryrefslogtreecommitdiff
path: root/node/Node.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-04-07 19:31:11 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-04-07 19:31:11 -0700
commit49f031ccb4d518e8a715777f5d848759bae0def8 (patch)
tree6f5d2fe9a753d36ac1da657142fc50645804466d /node/Node.hpp
parent9e55f882d3ca5a5615c21ebaec0702aaaf436e2b (diff)
downloadinfinitytier-49f031ccb4d518e8a715777f5d848759bae0def8.tar.gz
infinitytier-49f031ccb4d518e8a715777f5d848759bae0def8.zip
Tons of refactoring, change to desperation algorithm to use max of core or link, porting over core loop code from old Node.cpp to new CAPI version, etc.
Diffstat (limited to 'node/Node.hpp')
-rw-r--r--node/Node.hpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/node/Node.hpp b/node/Node.hpp
index d6be609e..2de35fb3 100644
--- a/node/Node.hpp
+++ b/node/Node.hpp
@@ -62,7 +62,8 @@ public:
ZT1_WirePacketSendFunction wirePacketSendFunction,
ZT1_VirtualNetworkFrameFunction virtualNetworkFrameFunction,
ZT1_VirtualNetworkConfigFunction virtualNetworkConfigFunction,
- ZT1_StatusCallback statusCallback);
+ ZT1_StatusCallback statusCallback,
+ const char *overrideRootTopology);
~Node();
@@ -74,7 +75,7 @@ public:
unsigned int linkDesperation,
const void *packetData,
unsigned int packetLength,
- uint64_t *nextCallDeadline);
+ uint64_t *nextBackgroundTaskDeadline);
ZT1_ResultCode processVirtualNetworkFrame(
uint64_t now,
uint64_t nwid,
@@ -84,8 +85,8 @@ public:
unsigned int vlanId,
const void *frameData,
unsigned int frameLength,
- uint64_t *nextCallDeadline);
- ZT1_ResultCode processBackgroundTasks(uint64_t now,uint64_t *nextCallDeadline);
+ uint64_t *nextBackgroundTaskDeadline);
+ ZT1_ResultCode processBackgroundTasks(uint64_t now,uint64_t *nextBackgroundTaskDeadline);
ZT1_ResultCode join(uint64_t nwid);
ZT1_ResultCode leave(uint64_t nwid);
ZT1_ResultCode multicastSubscribe(uint64_t nwid,uint64_t multicastGroup,unsigned long multicastAdi);
@@ -163,6 +164,8 @@ public:
return nw;
}
+ inline unsigned int coreDesperation() const throw() { return _coreDesperation; }
+
inline bool dataStorePut(const char *name,const void *data,unsigned int len,bool secure) { return (_dataStorePutFunction(reinterpret_cast<ZT1_Node *>(this),name,data,len,(int)secure) == 0); }
inline bool dataStorePut(const char *name,const std::string &data,bool secure) { return dataStorePut(name,(const void *)data.data(),(unsigned int)data.length(),secure); }
inline void dataStoreDelete(const char *name) { _dataStorePutFunction(reinterpret_cast<ZT1_Node *>(this),name,(const void *)0,0,0); }
@@ -190,7 +193,13 @@ private:
std::map< uint64_t,SharedPtr<Network> > _networks;
Mutex _networks_m;
- volatile uint64_t _now; // time of last run()
+ Mutex _backgroundTasksLock;
+
+ uint64_t _now;
+ uint64_t _startTimeAfterInactivity;
+ uint64_t _lastPingCheck;
+ uint64_t _lastHousekeepingRun;
+ unsigned int _coreDesperation;
unsigned int _newestVersionSeen[3]; // major, minor, revision
};