mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 02:44:20 -05:00
don't do a tunnell connect attempt when already connected through a tunnel
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1931 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b73216a297
commit
e708cf4257
@ -1495,12 +1495,27 @@ bool p3ConnectMgr::connectAttempt(std::string id, struct sockaddr_in &addr,
|
||||
std::cerr << "p3ConnectMgr::connectAttempt() FAILED No ConnectAddresses id: " << id << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
it->second.lastattempt = time(NULL) + ((time(NULL)*1664525 + 1013904223) % 3);//add a random perturbation between 0 and 2 sec. pseudo random number generator from Wikipedia/Numerical Recipies.
|
||||
}
|
||||
|
||||
it->second.inConnAttempt = true;
|
||||
it->second.currentConnAddrAttempt = it->second.connAddrs.front();
|
||||
if ((it->second.state & RS_PEER_S_CONNECTED) && it->second.connAddrs.front().type == RS_NET_CONN_TUNNEL) {
|
||||
//don't do a tunnel atemp if already connected via tunnel
|
||||
it->second.connAddrs.pop_front();
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::connectAttempt() avoiding tunnel connection attempt because already connected via tunnel. " << std::endl;
|
||||
#endif
|
||||
//returning next connect attempt.
|
||||
if (it->second.connAddrs.size() < 1)
|
||||
{
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::connectAttempt() FAILED No ConnectAddresses id: " << id << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
it->second.lastattempt = time(NULL) + ((time(NULL)*1664525 + 1013904223) % 3);//add a random perturbation between 0 and 2 sec. pseudo random number generator from Wikipedia/Numerical Recipies.
|
||||
it->second.inConnAttempt = true;
|
||||
it->second.currentConnAddrAttempt = it->second.connAddrs.front();
|
||||
it->second.connAddrs.pop_front();
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user