diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-02-10 17:51:42 -0800 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-02-10 17:51:42 -0800 |
commit | eadafd8de754336f8c06302305a26669762a365d (patch) | |
tree | 6a44474f497b05781e35cbce98fa2639793452cb /node | |
parent | f9230eb97077f628186f8966190b2237fa4ff5d5 (diff) | |
download | infinitytier-eadafd8de754336f8c06302305a26669762a365d.tar.gz infinitytier-eadafd8de754336f8c06302305a26669762a365d.zip |
Little fix to NAT-t alg
Diffstat (limited to 'node')
-rw-r--r-- | node/Switch.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp index 4c91a855..1ed1dfe6 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -490,10 +490,10 @@ unsigned long Switch::doTimerTasks(uint64_t now) // Strategies 1-3: try escalating ports for symmetric NATs that remap sequentially InetAddress tmpaddr(qi->inaddr); int p = (int)qi->inaddr.port() + qi->strategyIteration; - if (p < 0xffff) { - tmpaddr.setPort((unsigned int)p); - qi->peer->sendHELLO(qi->localAddr,tmpaddr,now); - } else qi->strategyIteration = 5; + if (p > 65535) + p -= 64511; + tmpaddr.setPort((unsigned int)p); + qi->peer->sendHELLO(qi->localAddr,tmpaddr,now); } else { // All strategies tried, expire entry _contactQueue.erase(qi++); |