mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
301e85c2fa
commit
72d3c868e3
@ -87,6 +87,8 @@ bdNodeManager::bdNodeManager(bdNodeId *id, std::string dhtVersion, std::string b
|
||||
mFns->bdPrintNodeId(std::cerr, id);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mLocalNetEnhancements = true;
|
||||
}
|
||||
|
||||
int bdNodeManager::stopDht()
|
||||
@ -400,34 +402,39 @@ void bdNodeManager::iteration()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
/* run a random search for ourselves, from own App DHT peer */
|
||||
QueryRandomLocalNet();
|
||||
|
||||
/* This stuff is only important for "LocalNet based Features */
|
||||
if (mLocalNetEnhancements)
|
||||
{
|
||||
/* run a random search for ourselves, from own App DHT peer */
|
||||
QueryRandomLocalNet();
|
||||
|
||||
#define SEARCH_MAX_SIZE 10
|
||||
if (mBdNetworkSize < SEARCH_MAX_SIZE)
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "Local Netsize: " << mBdNetworkSize << " to small...searching";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
/* if the network size is very small */
|
||||
SearchForLocalNet();
|
||||
mSearchingDone = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mSearchingDone)
|
||||
if (mBdNetworkSize < SEARCH_MAX_SIZE)
|
||||
{
|
||||
mSearchingDone = true;
|
||||
mSearchTS = now;
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "Completed LocalNet Search in : " << mSearchTS-mStartTS;
|
||||
std::cerr << "Local Netsize: " << mBdNetworkSize << " to small...searching";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
/* if the network size is very small */
|
||||
SearchForLocalNet();
|
||||
mSearchingDone = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mSearchingDone)
|
||||
{
|
||||
mSearchingDone = true;
|
||||
mSearchTS = now;
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "Completed LocalNet Search in : " << mSearchTS-mStartTS;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::iteration(): REFRESH ";
|
||||
std::cerr << std::endl;
|
||||
|
@ -187,6 +187,8 @@ void SearchForLocalNet();
|
||||
|
||||
bdBloom mBloomFilter;
|
||||
|
||||
bool mLocalNetEnhancements;
|
||||
|
||||
/* future node functions */
|
||||
//addPeerPing(foundId);
|
||||
//clearPing(it->first);
|
||||
|
@ -134,14 +134,14 @@ uint32_t bdNode::setNodeDhtMode(uint32_t dhtFlags)
|
||||
{
|
||||
default:
|
||||
case BITDHT_MODE_TRAFFIC_LOW:
|
||||
mMaxAllowedMsgs = BDNODE_HIGH_MSG_RATE;
|
||||
break;
|
||||
case BITDHT_MODE_TRAFFIC_HIGH:
|
||||
mMaxAllowedMsgs = BDNODE_LOW_MSG_RATE;
|
||||
break;
|
||||
case BITDHT_MODE_TRAFFIC_MED:
|
||||
mMaxAllowedMsgs = BDNODE_MED_MSG_RATE;
|
||||
break;
|
||||
case BITDHT_MODE_TRAFFIC_HIGH:
|
||||
mMaxAllowedMsgs = BDNODE_HIGH_MSG_RATE;
|
||||
break;
|
||||
case BITDHT_MODE_TRAFFIC_TRICKLE:
|
||||
mMaxAllowedMsgs = BDNODE_TRICKLE_MSG_RATE;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user