diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-03-01 10:22:57 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-03-01 10:22:57 -0800 |
| commit | 2bf9145ae65385bf968542619ffcf204cf6241d8 (patch) | |
| tree | b97d30342ef7c34fe0a1b236635d78ec29ed40d9 /node/Path.hpp | |
| parent | 127bcb02ffd09b522678c7e50aae21a1ecd87e4e (diff) | |
| download | infinitytier-2bf9145ae65385bf968542619ffcf204cf6241d8.tar.gz infinitytier-2bf9145ae65385bf968542619ffcf204cf6241d8.zip | |
Outgoing side of packet counter for link quality reporting. Also some cleanup and a cluster mode build fix.
Diffstat (limited to 'node/Path.hpp')
| -rw-r--r-- | node/Path.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/node/Path.hpp b/node/Path.hpp index 5993be69..626f2f4f 100644 --- a/node/Path.hpp +++ b/node/Path.hpp @@ -105,6 +105,7 @@ public: _lastOut(0), _lastIn(0), _lastTrustEstablishedPacketReceived(0), + _outgoingPacketCounter(0), _addr(), _localAddress(), _ipScope(InetAddress::IP_SCOPE_NONE) @@ -115,6 +116,7 @@ public: _lastOut(0), _lastIn(0), _lastTrustEstablishedPacketReceived(0), + _outgoingPacketCounter(0), _addr(addr), _localAddress(localAddress), _ipScope(addr.ipScope()) @@ -241,10 +243,18 @@ public: */ inline uint64_t lastIn() const { return _lastIn; } + /** + * Return and increment outgoing packet counter (used with Packet::armor()) + * + * @return Next value that should be used for outgoing packet counter (only least significant 3 bits are used) + */ + inline unsigned int nextOutgoingCounter() { return _outgoingPacketCounter++; } + private: uint64_t _lastOut; uint64_t _lastIn; uint64_t _lastTrustEstablishedPacketReceived; + unsigned int _outgoingPacketCounter; InetAddress _addr; InetAddress _localAddress; InetAddress::IpScope _ipScope; // memoize this since it's a computed value checked often |
