verify that ext addr is not 0

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1908 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2009-12-18 17:52:26 +00:00
parent c182f0c27d
commit 7efc0ef9b7

View File

@ -2450,6 +2450,15 @@ bool p3ConnectMgr::setExtAddress(std::string id, struct sockaddr_in addr)
ownState.currentserveraddr.sin_port != addr.sin_port) { ownState.currentserveraddr.sin_port != addr.sin_port) {
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/ RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
ownState.currentserveraddr = addr; ownState.currentserveraddr = addr;
//check port and address
if (ownState.currentserveraddr.sin_addr.s_addr == 0) {
//use internal port for now
ownState.currentserveraddr.sin_addr = ownState.currentlocaladdr.sin_addr;
}
if (addr.sin_port == 0) {
//use internal port for now
ownState.currentserveraddr.sin_port = ownState.currentlocaladdr.sin_port;
}
} }
return true; return true;
} }