mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-15 09:27:09 -05:00
perform a net reset when network config is changed
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1871 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
274479bc41
commit
b447a213ea
@ -574,7 +574,7 @@ void p3ConnectMgr::netTick()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RS_NET_LOOPBACK:
|
case RS_NET_LOOPBACK:
|
||||||
//don't do a shutdown because a client in a computer without network might be usefull for debug.
|
//don't do a shutdown because a client in a computer without local network might be usefull for debug.
|
||||||
//shutdown();
|
//shutdown();
|
||||||
#ifdef CONN_DEBUG
|
#ifdef CONN_DEBUG
|
||||||
std::cerr << "p3ConnectMgr::netTick() STATUS: RS_NET_LOOPBACK" << std::endl;
|
std::cerr << "p3ConnectMgr::netTick() STATUS: RS_NET_LOOPBACK" << std::endl;
|
||||||
@ -2398,15 +2398,22 @@ bool p3ConnectMgr::retryConnectNotify(std::string id)
|
|||||||
|
|
||||||
bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr)
|
bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
|
||||||
|
|
||||||
if (id == mAuthMgr->OwnId())
|
if (id == mAuthMgr->OwnId())
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||||
ownState.currentlocaladdr = addr;
|
ownState.currentlocaladdr = addr;
|
||||||
|
}
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
if ((ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_EXT ||
|
||||||
|
(ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_UDP) {
|
||||||
|
netReset();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||||
/* check if it is a friend */
|
/* check if it is a friend */
|
||||||
std::map<std::string, peerConnectState>::iterator it;
|
std::map<std::string, peerConnectState>::iterator it;
|
||||||
if (mFriendList.end() == (it = mFriendList.find(id)))
|
if (mFriendList.end() == (it = mFriendList.find(id)))
|
||||||
@ -2435,16 +2442,21 @@ bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr)
|
|||||||
|
|
||||||
bool p3ConnectMgr::setExtAddress(std::string id, struct sockaddr_in addr)
|
bool p3ConnectMgr::setExtAddress(std::string id, struct sockaddr_in addr)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
|
||||||
|
|
||||||
|
|
||||||
if (id == mAuthMgr->OwnId())
|
if (id == mAuthMgr->OwnId())
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||||
ownState.currentserveraddr = addr;
|
ownState.currentserveraddr = addr;
|
||||||
|
}
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
if ((ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_EXT ||
|
||||||
|
(ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_UDP) {
|
||||||
|
netReset();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||||
/* check if it is a friend */
|
/* check if it is a friend */
|
||||||
std::map<std::string, peerConnectState>::iterator it;
|
std::map<std::string, peerConnectState>::iterator it;
|
||||||
if (mFriendList.end() == (it = mFriendList.find(id)))
|
if (mFriendList.end() == (it = mFriendList.find(id)))
|
||||||
@ -2501,12 +2513,13 @@ bool p3ConnectMgr::setNetworkMode(std::string id, uint32_t netMode)
|
|||||||
{
|
{
|
||||||
uint32_t visState = ownState.visState;
|
uint32_t visState = ownState.visState;
|
||||||
setOwnNetConfig(netMode, visState);
|
setOwnNetConfig(netMode, visState);
|
||||||
|
if ((netMode & RS_NET_MODE_ACTUAL) != (ownState.netMode & RS_NET_MODE_ACTUAL)) {
|
||||||
|
netReset();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
/* check if it is a friend */
|
/* check if it is a friend */
|
||||||
std::map<std::string, peerConnectState>::iterator it;
|
std::map<std::string, peerConnectState>::iterator it;
|
||||||
if (mFriendList.end() == (it = mFriendList.find(id)))
|
if (mFriendList.end() == (it = mFriendList.find(id)))
|
||||||
|
Loading…
Reference in New Issue
Block a user