mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-30 19:34:31 -04:00
added server-based ip determination as a fallback to existing methods. Forced Dht publishing as soon as an external ip is known
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1109 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
db74c9ef58
commit
e23bd13bc9
4 changed files with 22 additions and 2 deletions
|
@ -26,6 +26,7 @@
|
|||
#include "pqi/p3connmgr.h"
|
||||
#include "pqi/p3dhtmgr.h" // Only need it for constants.
|
||||
#include "tcponudp/tou.h"
|
||||
#include "tcponudp/extaddrfinder.h"
|
||||
|
||||
#include "util/rsprint.h"
|
||||
#include "util/rsdebug.h"
|
||||
|
@ -122,6 +123,7 @@ p3ConnectMgr::p3ConnectMgr(p3AuthMgr *am)
|
|||
ownState.name = mAuthMgr->getName(ownState.id);
|
||||
ownState.netMode = RS_NET_MODE_UDP;
|
||||
}
|
||||
mExtAddrFinder = NULL ;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -404,6 +406,9 @@ void p3ConnectMgr::netTick()
|
|||
|
||||
uint32_t netStatus = mNetStatus;
|
||||
|
||||
if(mExtAddrFinder == NULL)
|
||||
mExtAddrFinder = new ExtAddrFinder ;
|
||||
|
||||
connMtx.unlock(); /* UNLOCK MUTEX */
|
||||
|
||||
switch(netStatus)
|
||||
|
@ -572,7 +577,9 @@ void p3ConnectMgr::netUdpCheck()
|
|||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::netUdpCheck()" << std::endl;
|
||||
#endif
|
||||
if (udpExtAddressCheck() || (mUpnpAddrValid))
|
||||
struct sockaddr_in tmpip ;
|
||||
|
||||
if (udpExtAddressCheck() || (mUpnpAddrValid) || mExtAddrFinder->hasValidIP(&tmpip))
|
||||
{
|
||||
bool extValid = false;
|
||||
bool extAddrStable = false;
|
||||
|
@ -598,6 +605,13 @@ void p3ConnectMgr::netUdpCheck()
|
|||
extAddr = mStunExtAddr;
|
||||
extAddrStable = mStunAddrStable;
|
||||
}
|
||||
else if(mExtAddrFinder->hasValidIP(&tmpip))
|
||||
{
|
||||
extValid = true;
|
||||
extAddr = tmpip ;
|
||||
extAddr.sin_port = iaddr.sin_port ;
|
||||
extAddrStable = true;
|
||||
}
|
||||
|
||||
if (extValid)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue