mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 08:16:59 -05:00
change the address selection of udp connection
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1869 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f610e09f5c
commit
892598d6eb
@ -2254,7 +2254,14 @@ bool p3ConnectMgr::retryConnectTCP(std::string id)
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && !isSameSubnet(&ipListIt->ipAddr.sin_addr, &ownState.currentlocaladdr.sin_addr)) {//add only if in different subnet
|
||||
/* Try not to add internal address like 192.168.x.x
|
||||
* check that the (addr1 & 255.255.0.0) == (addr2 & 255.255.0.0)
|
||||
*/
|
||||
unsigned long a1 = ntohl(ipListIt->ipAddr.sin_addr.s_addr);
|
||||
unsigned long a2 = ntohl(ownState.currentlocaladdr.sin_addr.s_addr);
|
||||
bool isLocal = ((a1 & 0xffff0000) == (a2 & 0xffff0000));
|
||||
|
||||
if (!found && !isLocal && !isSameSubnet(&ipListIt->ipAddr.sin_addr, &ownState.currentlocaladdr.sin_addr)) {//add only if in different subnet
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "Adding udp connection attempt." << std::endl;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user