mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-07 22:02:32 -04:00
Merging from branches/v0.5-peernet/libbitdht (--- Merging r4354 through r4356 into '.')
* adding Bloom filter to speed up finding RS peers. * fixed startup bug. (loops into FAILURE) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4357 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
702ff44194
commit
79b48d5a89
15 changed files with 820 additions and 21 deletions
|
@ -297,6 +297,7 @@ int bdQueryManager::getResults(bdNodeId *target, std::list<bdId> &answer, int q
|
|||
/* will only be one matching query.. so end loop */
|
||||
return results;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -328,10 +329,10 @@ void bdQueryManager::addWorthyPeerSource(bdId *src)
|
|||
peer.mPeerId = *src;
|
||||
peer.mFoundTime = now;
|
||||
|
||||
#ifdef DEBUG_NODE_ACTIONS
|
||||
std::cerr << "bdQueryManager::addWorthyPeerSource(";
|
||||
mFns->bdPrintId(std::cerr, src);
|
||||
std::cerr << ")" << std::endl;
|
||||
#ifdef DEBUG_NODE_ACTIONS
|
||||
#endif
|
||||
|
||||
mWorthyPeerSources.push_back(peer);
|
||||
|
@ -348,9 +349,11 @@ bool bdQueryManager::checkWorthyPeerSources(bdId *src)
|
|||
{
|
||||
if (now - it->mFoundTime > MAX_WORTHY_PEER_AGE)
|
||||
{
|
||||
#ifdef DEBUG_NODE_ACTIONS
|
||||
std::cerr << "bdQueryManager::checkWorthyPeerSource() Discard old Source: ";
|
||||
mFns->bdPrintId(std::cerr, &(it->mPeerId));
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
it = mWorthyPeerSources.erase(it);
|
||||
}
|
||||
|
@ -358,9 +361,11 @@ bool bdQueryManager::checkWorthyPeerSources(bdId *src)
|
|||
{
|
||||
if (it->mPeerId == *src)
|
||||
{
|
||||
//std::cerr << "bdQueryManager::checkWorthyPeerSource(";
|
||||
//mFns->bdPrintId(std::cerr, src);
|
||||
//std::cerr << ") = true" << std::endl;
|
||||
#ifdef DEBUG_NODE_ACTIONS
|
||||
std::cerr << "bdQueryManager::checkWorthyPeerSource(";
|
||||
mFns->bdPrintId(std::cerr, src);
|
||||
std::cerr << ") = true" << std::endl;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue