diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-03-03 13:49:21 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-03-03 13:49:21 -0800 |
| commit | d56f740dc6cf35bd4e26c17503170d0f6c8035ec (patch) | |
| tree | 97e73d34c2c883f0831be9fca66d7fab2e03ec56 /node/Node.hpp | |
| parent | a109d341ef72149dad5eae0b616a1f47d24487f9 (diff) | |
| download | infinitytier-d56f740dc6cf35bd4e26c17503170d0f6c8035ec.tar.gz infinitytier-d56f740dc6cf35bd4e26c17503170d0f6c8035ec.zip | |
Now with less bugs.
Diffstat (limited to 'node/Node.hpp')
| -rw-r--r-- | node/Node.hpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/node/Node.hpp b/node/Node.hpp index 39cf2601..ab201f06 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -227,8 +227,9 @@ public: */ inline void expectReplyTo(const uint64_t packetId) { - const unsigned long bucket = (unsigned long)(packetId & ZT_EXPECTING_REPLIES_BUCKET_MASK1); - _expectingRepliesTo[bucket][_expectingRepliesToBucketPtr[bucket]++ & ZT_EXPECTING_REPLIES_BUCKET_MASK2] = (uint32_t)(packetId >> 32); + const unsigned long pid2 = (unsigned long)(packetId >> 32); + const unsigned long bucket = (unsigned long)(pid2 & ZT_EXPECTING_REPLIES_BUCKET_MASK1); + _expectingRepliesTo[bucket][_expectingRepliesToBucketPtr[bucket]++ & ZT_EXPECTING_REPLIES_BUCKET_MASK2] = (uint32_t)pid2; } /** @@ -243,10 +244,10 @@ public: */ inline bool expectingReplyTo(const uint64_t packetId) const { - const unsigned long bucket = (unsigned long)(packetId & ZT_EXPECTING_REPLIES_BUCKET_MASK1); - const uint32_t pid = (uint32_t)(packetId >> 32); + const uint32_t pid2 = (uint32_t)(packetId >> 32); + const unsigned long bucket = (unsigned long)(pid2 & ZT_EXPECTING_REPLIES_BUCKET_MASK1); for(unsigned long i=0;i<=ZT_EXPECTING_REPLIES_BUCKET_MASK2;++i) { - if (_expectingRepliesTo[bucket][i] == pid) + if (_expectingRepliesTo[bucket][i] == pid2) return true; } return false; |
