ensure that local address is not 0.0.0.0 or port is 0 in the connect manager

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

View File

@ -2406,6 +2406,13 @@ bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr)
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
ownState.currentlocaladdr = addr;
//avoid 0 for port and address
if (ownState.currentlocaladdr.sin_addr.s_addr == 0) {
ownState.currentlocaladdr.sin_addr.s_addr = 1;
}
if (addr.sin_port == 0) {
ownState.currentlocaladdr.sin_port = 1;
}
}
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
if ((ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_EXT ||