Fixed up BITDHT versioning.

* Advertises client as DBxxxx where xxxx is provided by using app.
  * Added COMPILE switches to enable ANONYMOUS version or remove BD portion.
  * Fixed version code.
  * Added slow increase in retry timeout, to reduce DHT traffic over time.
      now RETRY PERIOD = query age / 2  
  * initialised bdToken bdVersion etc length.
  * new bdboot.txt 



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3615 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2010-10-05 21:57:22 +00:00
parent d31cef0f11
commit cc5fa5e5dc
9 changed files with 268 additions and 208 deletions

View file

@ -38,7 +38,7 @@
#define EXPECTED_REPLY 20
#define QUERY_IDLE_RETRY_PEER_PERIOD (mFns->bdNodesPerBucket() * 30)
#define QUERY_IDLE_RETRY_PEER_PERIOD 300 // 5min = (mFns->bdNodesPerBucket() * 30)
/************************************************************
@ -81,6 +81,8 @@ bdQuery::bdQuery(const bdNodeId *id, std::list<bdId> &startList, uint32_t queryF
mQueryFlags = queryFlags;
mQueryTS = now;
mQueryIdlePeerRetryPeriod = QUERY_IDLE_RETRY_PEER_PERIOD;
/* setup the limit of the search
* by default it is setup to 000000 = exact match
*/
@ -114,6 +116,13 @@ int bdQuery::nextQuery(bdId &id, bdNodeId &targetNodeId)
/* search through through list, find closest not queried */
time_t now = time(NULL);
/* update IdlePeerRetry */
if ((now - mQueryTS) / 2 > mQueryIdlePeerRetryPeriod)
{
mQueryIdlePeerRetryPeriod = (now-mQueryTS) / 2;
}
bool notFinished = false;
std::multimap<bdMetric, bdPeer>::iterator it;
for(it = mClosest.begin(); it != mClosest.end(); it++)
@ -133,7 +142,7 @@ int bdQuery::nextQuery(bdId &id, bdNodeId &targetNodeId)
/* re-request every so often */
if ((!queryPeer) && (mQueryFlags & BITDHT_QFLAGS_DO_IDLE) &&
(now - it->second.mLastSendTime > QUERY_IDLE_RETRY_PEER_PERIOD))
(now - it->second.mLastSendTime > mQueryIdlePeerRetryPeriod))
{
#ifdef DEBUG_QUERY
fprintf(stderr, "NextQuery() Found out-of-date. queryPeer = true : ");