Tweaks to bitdht library for standalone single search option.

- Added flag to disable local Network search.
 - Fixed DHT Msg Rate bug (ported from trunk).



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5731 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-10-28 14:10:56 +00:00
parent 301e85c2fa
commit 72d3c868e3
3 changed files with 32 additions and 23 deletions

View file

@ -87,6 +87,8 @@ bdNodeManager::bdNodeManager(bdNodeId *id, std::string dhtVersion, std::string b
mFns->bdPrintNodeId(std::cerr, id); mFns->bdPrintNodeId(std::cerr, id);
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
mLocalNetEnhancements = true;
} }
int bdNodeManager::stopDht() int bdNodeManager::stopDht()
@ -400,6 +402,10 @@ void bdNodeManager::iteration()
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
/* This stuff is only important for "LocalNet based Features */
if (mLocalNetEnhancements)
{
/* run a random search for ourselves, from own App DHT peer */ /* run a random search for ourselves, from own App DHT peer */
QueryRandomLocalNet(); QueryRandomLocalNet();
@ -427,6 +433,7 @@ void bdNodeManager::iteration()
#endif #endif
} }
} }
}
#ifdef DEBUG_MGR #ifdef DEBUG_MGR
std::cerr << "bdNodeManager::iteration(): REFRESH "; std::cerr << "bdNodeManager::iteration(): REFRESH ";

View file

@ -187,6 +187,8 @@ void SearchForLocalNet();
bdBloom mBloomFilter; bdBloom mBloomFilter;
bool mLocalNetEnhancements;
/* future node functions */ /* future node functions */
//addPeerPing(foundId); //addPeerPing(foundId);
//clearPing(it->first); //clearPing(it->first);

View file

@ -134,14 +134,14 @@ uint32_t bdNode::setNodeDhtMode(uint32_t dhtFlags)
{ {
default: default:
case BITDHT_MODE_TRAFFIC_LOW: case BITDHT_MODE_TRAFFIC_LOW:
mMaxAllowedMsgs = BDNODE_HIGH_MSG_RATE;
break;
case BITDHT_MODE_TRAFFIC_HIGH:
mMaxAllowedMsgs = BDNODE_LOW_MSG_RATE; mMaxAllowedMsgs = BDNODE_LOW_MSG_RATE;
break; break;
case BITDHT_MODE_TRAFFIC_MED: case BITDHT_MODE_TRAFFIC_MED:
mMaxAllowedMsgs = BDNODE_MED_MSG_RATE; mMaxAllowedMsgs = BDNODE_MED_MSG_RATE;
break; break;
case BITDHT_MODE_TRAFFIC_HIGH:
mMaxAllowedMsgs = BDNODE_HIGH_MSG_RATE;
break;
case BITDHT_MODE_TRAFFIC_TRICKLE: case BITDHT_MODE_TRAFFIC_TRICKLE:
mMaxAllowedMsgs = BDNODE_TRICKLE_MSG_RATE; mMaxAllowedMsgs = BDNODE_TRICKLE_MSG_RATE;
break; break;