mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 07:59:35 -05:00
added early check of ExtAddrFinder and notify about its results
This commit is contained in:
parent
d4141c493d
commit
67cf8baf77
@ -466,6 +466,30 @@ void p3NetMgrIMPL::netStatusTick()
|
||||
|
||||
}
|
||||
|
||||
if(netStatus <= RS_NET_UPNP_SETUP && mUseExtAddrFinder)
|
||||
{
|
||||
sockaddr_storage tmpip;
|
||||
|
||||
if(mExtAddrFinder->hasValidIP(tmpip) && sockaddr_storage_ipv6_to_ipv4(tmpip))
|
||||
{
|
||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||
std::cerr << "p3NetMgrIMPL::netExtCheck() Ext supplied by ExtAddrFinder" << std::endl;
|
||||
#endif
|
||||
sockaddr_storage_setport(tmpip, guessNewExtPort());
|
||||
|
||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||
std::cerr << "p3NetMgrIMPL::netExtCheck() ";
|
||||
std::cerr << "ExtAddr: " << sockaddr_storage_tostring(tmpip);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
/* XXX HACK TO FIX drbob: ALLOWING
|
||||
* ExtAddrFinder -> ExtAddrStableOk = true
|
||||
* (which it is not normally) */
|
||||
|
||||
setExtAddress(tmpip);
|
||||
}
|
||||
}
|
||||
|
||||
switch(netStatus)
|
||||
{
|
||||
case RS_NET_NEEDS_RESET:
|
||||
@ -518,6 +542,10 @@ void p3NetMgrIMPL::netStatusTick()
|
||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||
std::cerr << "p3NetMgrIMPL::netTick() STATUS: EXT_SETUP" << std::endl;
|
||||
#endif
|
||||
// This could take a lot of time on some systems to get there:
|
||||
// (e.g. 10 mins to get passed upnp on windows), so it would be better to call it right away, so other external address finding
|
||||
// systems still have a chance to run early.
|
||||
|
||||
netExtCheck();
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user