Reworking of networking code to enable Net Restart.

* Stun code now runs continually - to check external network state.
  * Udpsorter controls DHT stun is on/off. (via p3ConnectMgr)
  * added code to enable threads to join/restart 
  * enabled NetRestart for UDP and TCP.
  * tweaked networking code for faster startup (now ~30 seconds - can still be improved).
  * tweaked debug messages for testing networking
  * Added test for checking external IP address determination.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1492 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2009-08-04 23:22:44 +00:00
parent d5581629ef
commit 2bf94b909a
22 changed files with 774 additions and 81 deletions

View file

@ -66,7 +66,7 @@ const int p3dhtzone = 3892;
#define DHT_DEFAULT_WAITTIME 1 /* Std sleep break period */
#define DHT_NUM_BOOTSTRAP_BINS 8
#define DHT_MIN_BOOTSTRAP_REQ_PERIOD 30
#define DHT_MIN_BOOTSTRAP_REQ_PERIOD 5
void printDhtPeerEntry(dhtPeerEntry *ent, std::ostream &out);
@ -1027,20 +1027,21 @@ int p3DhtMgr::checkStunState()
}
else if (mDhtState == DHT_STATE_FIND_STUN)
{
/* if we run out of stun peers -> get some more */
if (stunIds.size() < 1)
{
}
/* if we run out of stun peers -> get some more */
if (stunIds.size() < 1)
{
#ifdef DHT_DEBUG
std::cerr << "WARNING: out of Stun Peers - switching to Active Now" << std::endl;
std::cerr << "WARNING: out of Stun Peers - Fetching some more" << std::endl;
#endif
mDhtState = DHT_STATE_ACTIVE;
dhtMtx.unlock(); /* UNLOCK MUTEX */
mDhtState = DHT_STATE_ACTIVE;
dhtMtx.unlock(); /* UNLOCK MUTEX */
/* this is a locked function */
getDhtBootstrapList();
/* this is a locked function */
getDhtBootstrapList();
dhtMtx.lock(); /* LOCK MUTEX */
}
dhtMtx.lock(); /* LOCK MUTEX */
}
dhtMtx.unlock(); /* UNLOCK MUTEX */