diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-04-06 15:03:08 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-04-06 15:03:08 -0700 |
commit | be4683a96d2dfdf8d1b1596281b82b0a43d1f779 (patch) | |
tree | 04ce05e23b674fcf8efc3e29733daf81e43699d4 /node/Switch.cpp | |
parent | 5f351f2f6b775f5813f948594f30ddb5effdff65 (diff) | |
download | infinitytier-be4683a96d2dfdf8d1b1596281b82b0a43d1f779.tar.gz infinitytier-be4683a96d2dfdf8d1b1596281b82b0a43d1f779.zip |
Get rid of random port strategy -- research does not support.
Diffstat (limited to 'node/Switch.cpp')
-rw-r--r-- | node/Switch.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp index 5e120341..61062c48 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -467,9 +467,8 @@ unsigned long Switch::doTimerTasks() // Second strategy: shotgun method up: try a few ports above ++qi->strategyIteration; int p = (int)qi->inaddr.port(); - for(int i=0;i<6;++i) { - if (++p > 0xffff) - break; + for(int i=0;i<9;++i) { + if (++p > 0xffff) break; InetAddress tmpaddr(qi->inaddr); tmpaddr.setPort((unsigned int)p); RR->node->putPacket(tmpaddr,outp.data(),outp.size(),qi->currentDesperation); @@ -480,20 +479,11 @@ unsigned long Switch::doTimerTasks() ++qi->strategyIteration; int p = (int)qi->inaddr.port(); for(int i=0;i<3;++i) { - if (--p < 1024) - break; + if (--p < 1024) break; InetAddress tmpaddr(qi->inaddr); tmpaddr.setPort((unsigned int)p); RR->node->putPacket(tmpaddr,outp.data(),outp.size(),qi->currentDesperation); } - } break; - case 3: - // Fourth strategy: sawed-off shotgun: try random non-privileged ports - for(int i=0;i<16;++i) { - InetAddress tmpaddr(qi->inaddr); - tmpaddr.setPort((unsigned int)(1024 + (RR->prng->next32() % (65536 - 1024)))); - RR->node->putPacket(tmpaddr,outp.data(),outp.size(),qi->currentDesperation); - } // Escalate link desperation after all strategies attempted ++qi->currentDesperation; @@ -505,7 +495,7 @@ unsigned long Switch::doTimerTasks() // Otherwise restart at new link desperation level (e.g. try a tougher transport) qi->strategyIteration = 0; } - break; + } break; } qi->fireAtTime = now + ZT_NAT_T_TACTICAL_ESCALATION_DELAY; |