mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
start listener not immediately after net reset to avoid connection flickering. Stop listeners is here but not implemented
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1924 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bc27e188f9
commit
106645f5e5
@ -100,7 +100,7 @@ peerConnectState::peerConnectState()
|
||||
lastcontact(0),
|
||||
connecttype(0),
|
||||
lastavailable(0),
|
||||
lastattempt(time(NULL) - MIN_RETRY_PERIOD + 6), //start connection in 6 sec
|
||||
lastattempt(time(NULL) - MIN_RETRY_PERIOD + MIN_TIME_BETWEEN_NET_RESET + 2), //start connection 2 second after the possible next one net reset
|
||||
name("nameless"), state(0), actions(0),
|
||||
source(0),
|
||||
inConnAttempt(0)
|
||||
@ -320,9 +320,17 @@ void p3ConnectMgr::netReset()
|
||||
/* check Network Address */
|
||||
checkNetAddress();
|
||||
|
||||
/* reset udp network - handled by tou_init! */
|
||||
/* reset tcp network - if necessary */
|
||||
std::cerr << "p3ConnectMgr::netReset() done" << std::endl;
|
||||
}
|
||||
|
||||
/* to allow resets of network stuff */
|
||||
void p3ConnectMgr::addNetListener(pqiNetListener *listener)
|
||||
{
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
mNetListeners.push_back(listener);
|
||||
}
|
||||
|
||||
void p3ConnectMgr::startListeners() {
|
||||
/* NOTE: nNetListeners should be protected via the Mutex.
|
||||
* HOWEVER, as we NEVER change this list - once its setup
|
||||
* we can get away without it - and assume its constant.
|
||||
@ -338,19 +346,14 @@ void p3ConnectMgr::netReset()
|
||||
std::cerr << "p3ConnectMgr::netReset() reset listener" << std::endl;
|
||||
(*it)->reset_listener();
|
||||
}
|
||||
mListenerActive = true;
|
||||
}
|
||||
|
||||
std::cerr << "p3ConnectMgr::netReset() done" << std::endl;
|
||||
void p3ConnectMgr::stopListeners() {
|
||||
//TODO implement it
|
||||
mListenerActive = false;
|
||||
}
|
||||
|
||||
/* to allow resets of network stuff */
|
||||
void p3ConnectMgr::addNetListener(pqiNetListener *listener)
|
||||
{
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
mNetListeners.push_back(listener);
|
||||
}
|
||||
|
||||
|
||||
void p3ConnectMgr::netStatusReset()
|
||||
{
|
||||
//std::cerr << "p3ConnectMgr::netStatusReset()" << std::endl;;
|
||||
@ -442,6 +445,7 @@ bool p3ConnectMgr::shutdown() /* blocking shutdown call */
|
||||
}
|
||||
netAssistFirewallShutdown();
|
||||
netAssistConnectShutdown();
|
||||
stopListeners(); //not implemented yet
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -530,6 +534,12 @@ void p3ConnectMgr::netTick()
|
||||
uint32_t netStatus = mNetStatus;
|
||||
|
||||
connMtx.unlock(); /* UNLOCK MUTEX */
|
||||
/* start tcp network - if necessary */
|
||||
//TODO : implement stop listeners in net reset
|
||||
if (!mListenerActive && netStatus != RS_NET_NEED_RESET && (time(NULL) - mNetInitTS) > (MIN_TIME_BETWEEN_NET_RESET + 2)) {//start connection 2 second after the possible next one net reset
|
||||
startListeners();
|
||||
}
|
||||
|
||||
|
||||
switch(netStatus)
|
||||
{
|
||||
|
@ -382,9 +382,12 @@ private:
|
||||
RsMutex connMtx; /* protects below */
|
||||
|
||||
std::list<pqiNetListener *> mNetListeners;
|
||||
void stopListeners();
|
||||
void startListeners();
|
||||
|
||||
time_t mNetInitTS;
|
||||
uint32_t mNetStatus;
|
||||
bool mListenerActive;
|
||||
|
||||
uint32_t mStunStatus;
|
||||
uint32_t mStunFound;
|
||||
|
@ -119,7 +119,7 @@ pqissltunnel::pqissltunnel(PQInterface *parent, p3AuthMgr *am, p3ConnectMgr *cm)
|
||||
pqissltunnel::~pqissltunnel() {
|
||||
rslog(RSL_ALERT, pqisslzone,
|
||||
"pqissltunnel::~pqissltunnel -> destroying pqissl");
|
||||
stoplistening(); /* remove from pqissllistener only */
|
||||
//stoplistening();
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user