Merged from /branches/v0.5-peernet/libbitdht:r4357-4397

Bugfixes and a couple of small improvements to the DHT code.
 * fixed up buggy overloading for the udplayer (for testing).
 * added processing multiple (5) remote processes per tick. 
     - (1 wasn't enough in testing, and led to dropped peers) 
 * removed unused variables from query data structure.
 * #defined out debugging in bdSpace, removed old functions.
 * More agressive attempts to find proxies for connections.
 * made "final query attempt" use exact peer address rather than midid.
     - mid id meant that the target wasn't always returned.
 * tweaked bdconnection debugging.
 * increase CONNECTION_MAX_TIMEOUT from 30 => 45. wasn't enough!
 * Limited bdQuery::QueryIdlePeriod to 15min (was unlimited).
 * added bdQuery::PotentialPeer cleanup functions - for more robust reporting.
 * fixed bdQuery debugging printouts.
 * Implemented BITDHT_QFLAGS_UPDATES flag.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4398 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-07-06 00:14:58 +00:00
parent 24351cb460
commit 5e691935fd
14 changed files with 202 additions and 131 deletions

View file

@ -45,7 +45,9 @@
#define BITDHT_QUERY_START_PEERS 10
#define BITDHT_QUERY_NEIGHBOUR_PEERS 8
#define BITDHT_MAX_REMOTE_QUERY_AGE 10
#define MAX_REMOTE_PROCESS_PER_CYCLE 5
/****
* #define USE_HISTORY 1
@ -477,11 +479,13 @@ void bdNode::addPeer(const bdId *id, uint32_t peerflags)
}
/************************************ Process Remote Query *************************/
/* increased the allowed processing rate from 1/sec => 5/sec */
void bdNode::processRemoteQuery()
{
bool processed = false;
int nProcessed = 0;
time_t oldTS = time(NULL) - BITDHT_MAX_REMOTE_QUERY_AGE;
while(!processed)
while(nProcessed < MAX_REMOTE_PROCESS_PER_CYCLE)
{
/* extra exit clause */
if (mRemoteQueries.size() < 1) return;
@ -492,7 +496,7 @@ void bdNode::processRemoteQuery()
if (query.mQueryTS > oldTS)
{
/* recent enough to process! */
processed = true;
nProcessed++;
switch(query.mQueryType)
{
@ -541,7 +545,7 @@ void bdNode::processRemoteQuery()
{
/* drop */
/* unprocess! */
processed = false;
nProcessed--;
break;
}
}
@ -551,10 +555,10 @@ void bdNode::processRemoteQuery()
}
else
{
#ifdef DEBUG_NODE_MSGS
std::cerr << "bdNode::processRemoteQuery() Query Too Old: Discarding: ";
mFns->bdPrintId(std::cerr, &(query.mId));
std::cerr << std::endl;
#ifdef DEBUG_NODE_MSGS
#endif
}