From f4fd2d497109f9db2f4a2834262e62289fafb317 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 6 Apr 2015 14:50:53 -0700 Subject: Bring IncomingPacket into line with new changes. --- node/Node.hpp | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) (limited to 'node/Node.hpp') diff --git a/node/Node.hpp b/node/Node.hpp index 2dbf64b2..49871f5a 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -115,12 +115,16 @@ public: */ inline bool putPacket(const InetAddress &addr,const void *data,unsigned int len,unsigned int desperation) { - return (_wirePacketSendFunction( - reinterpret_cast(this), - reinterpret_cast(&addr), - desperation, - data, - len) == 0); + try { + return (_wirePacketSendFunction( + reinterpret_cast(this), + reinterpret_cast(&addr), + desperation, + data, + len) == 0); + } catch ( ... ) { // callbacks should not throw + return false; + } } /** @@ -136,21 +140,19 @@ public: */ inline void putFrame(uint64_t nwid,const MAC &source,const MAC &dest,unsigned int etherType,unsigned int vlanId,const void *data,unsigned int len) { - _virtualNetworkFrameFunction( - reinterpret_cast(this), - nwid, - source.toInt(), - dest.toInt(), - etherType, - vlanId, - data, - len); + try { + _virtualNetworkFrameFunction( + reinterpret_cast(this), + nwid, + source.toInt(), + dest.toInt(), + etherType, + vlanId, + data, + len); + } catch ( ... ) {} // callbacks should not throw } - /** - * @param nwid Network ID - * @return Network instance - */ inline SharedPtr network(uint64_t nwid) { Mutex::Lock _l(_networks_m); @@ -160,12 +162,12 @@ public: inline bool dataStorePut(const char *name,const void *data,unsigned int len,bool secure) { return (_dataStorePutFunction(reinterpret_cast(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(this),name,(const void *)0,0,0); } + std::string dataStoreGet(const char *name); - inline std::string dataStoreGet(const char *name) - { - } + inline void postEvent(ZT1_Event ev) { _statusCallback(reinterpret_cast(this),ev); } - inline void dataStoreDelete(const char *name) { _dataStorePutFunction(reinterpret_cast(this),name,(const void *)0,0,0); } + void postNewerVersionIfNewer(unsigned int major,unsigned int minor,unsigned int rev); private: RuntimeEnvironment *RR; @@ -184,6 +186,7 @@ private: Mutex _networks_m; volatile uint64_t _now; // time of last run() + unsigned int _newestVersionSeen[3]; // major, minor, revision }; } // namespace ZeroTier -- cgit v1.2.3