mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-11 15:33:07 +00:00
testing
This commit is contained in:
parent
b81ad9a84d
commit
f2060e0c76
@ -14,7 +14,7 @@
|
|||||||
#ifdef ZT_USE_MINIUPNPC
|
#ifdef ZT_USE_MINIUPNPC
|
||||||
|
|
||||||
// Uncomment to dump debug messages
|
// Uncomment to dump debug messages
|
||||||
//#define ZT_PORTMAPPER_TRACE 1
|
#define ZT_PORTMAPPER_TRACE 1
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
@ -87,13 +87,14 @@ public:
|
|||||||
|
|
||||||
while (run) {
|
while (run) {
|
||||||
|
|
||||||
|
{
|
||||||
// use initnatpmp to check if we can bind a port at all
|
// use initnatpmp to check if we can bind a port at all
|
||||||
natpmp_t _natpmp;
|
natpmp_t _natpmp;
|
||||||
int result = initnatpmp(&_natpmp,0,0);
|
int result = initnatpmp(&_natpmp,0,0);
|
||||||
if (result !=0 ) {
|
if (result == NATPMP_ERR_CANNOTGETGATEWAY || result == NATPMP_ERR_SOCKETERROR) {
|
||||||
closenatpmp(&_natpmp);
|
closenatpmp(&_natpmp);
|
||||||
#ifdef ZT_PORTMAPPER_TRACE
|
#ifdef ZT_PORTMAPPER_TRACE
|
||||||
PM_TRACE("PortMapper: init failed %d. You might not have any IP addresses yet. Trying again in %d" ZT_EOL_S, retrytime);
|
PM_TRACE("PortMapper: init failed %d. You might not have an internet connection yet. Trying again in %d" ZT_EOL_S, result, retrytime);
|
||||||
#endif
|
#endif
|
||||||
Thread::sleep(retrytime);
|
Thread::sleep(retrytime);
|
||||||
retrytime = retrytime * 2;
|
retrytime = retrytime * 2;
|
||||||
@ -105,6 +106,7 @@ public:
|
|||||||
closenatpmp(&_natpmp);
|
closenatpmp(&_natpmp);
|
||||||
retrytime = 500;
|
retrytime = 500;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// NAT-PMP mode (preferred)
|
// NAT-PMP mode (preferred)
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
@ -313,7 +315,6 @@ public:
|
|||||||
#ifdef ZT_PORTMAPPER_TRACE
|
#ifdef ZT_PORTMAPPER_TRACE
|
||||||
PM_TRACE("PortMapper: upnpDiscover failed, returning to NAT-PMP mode: %d" ZT_EOL_S,upnpError);
|
PM_TRACE("PortMapper: upnpDiscover failed, returning to NAT-PMP mode: %d" ZT_EOL_S,upnpError);
|
||||||
#endif
|
#endif
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user