mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-22 05:14:31 -04:00
small change in ext address detection
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2477 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6ab15c8f83
commit
5ed5e8eb92
2 changed files with 29 additions and 21 deletions
|
@ -550,21 +550,23 @@ void p3disc::recvPeerDetails(RsDiscReply *item)
|
|||
mConnMgr->setLocation(pitem->pid, pitem->location);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pitem->currentremoteaddr.sin_addr.s_addr != 0 && pitem->currentremoteaddr.sin_port != 0 &&
|
||||
pitem->currentremoteaddr.sin_addr.s_addr != 1 && pitem->currentremoteaddr.sin_port != 1 &&
|
||||
std::string(inet_ntoa(pitem->currentremoteaddr.sin_addr)) != "1.1.1.1" &&
|
||||
(!isLoopbackNet(&pitem->currentremoteaddr.sin_addr)) &&
|
||||
(!isPrivateNet(&pitem->currentremoteaddr.sin_addr))
|
||||
) {
|
||||
//the current server address given by the peer looks nice, let's use it for our own ext address if needed
|
||||
sockaddr_in tempAddr;
|
||||
if (!mConnMgr->getExtFinderExtAddress(tempAddr) && !mConnMgr->getUpnpExtAddress(tempAddr)) {
|
||||
//don't change the port, just the ip
|
||||
pitem->currentremoteaddr.sin_port = mConnMgr->ownState.currentserveraddr.sin_port;
|
||||
mConnMgr->setExtAddress(mConnMgr->getOwnId(), pitem->currentremoteaddr);
|
||||
}
|
||||
}
|
||||
|
||||
//useless, we will exploit the list in the connect manager
|
||||
// } else {
|
||||
// if (pitem->currentremoteaddr.sin_addr.s_addr != 0 && pitem->currentremoteaddr.sin_port != 0 &&
|
||||
// pitem->currentremoteaddr.sin_addr.s_addr != 1 && pitem->currentremoteaddr.sin_port != 1 &&
|
||||
// std::string(inet_ntoa(pitem->currentremoteaddr.sin_addr)) != "1.1.1.1" &&
|
||||
// (!isLoopbackNet(&pitem->currentremoteaddr.sin_addr)) &&
|
||||
// (!isPrivateNet(&pitem->currentremoteaddr.sin_addr))
|
||||
// ) {
|
||||
// //the current server address given by the peer looks nice, let's use it for our own ext address if needed
|
||||
// sockaddr_in tempAddr;
|
||||
// if (!mConnMgr->getExtFinderExtAddress(tempAddr) && !mConnMgr->getUpnpExtAddress(tempAddr)) {
|
||||
// //don't change the port, just the ip
|
||||
// pitem->currentremoteaddr.sin_port = mConnMgr->ownState.currentserveraddr.sin_port;
|
||||
// mConnMgr->setExtAddress(mConnMgr->getOwnId(), pitem->currentremoteaddr);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//allways update address list
|
||||
mConnMgr->setAddressList(pitem->pid, pitem->ipAddressList);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue