mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-26 07:11:08 -04:00
Merging branches/v0.5-peernet/libbitdht (Merging r4237 through r4353 into '.')
There are many significant improvements to the DHT here. See commit logs on v0.5-peernet branch for details. This is not the final merge, but brings over the majority of expected v0.5-peernet/libbitdht changes git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4354 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f517442989
commit
fff40eceac
40 changed files with 6843 additions and 746 deletions
|
@ -101,6 +101,7 @@ int bdStore::reloadFromStore()
|
|||
|
||||
}
|
||||
|
||||
// This is a very ugly function!
|
||||
int bdStore::getPeer(bdPeer *peer)
|
||||
{
|
||||
#ifdef DEBUG_STORE
|
||||
|
@ -119,6 +120,34 @@ int bdStore::getPeer(bdPeer *peer)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bdStore::filterIpList(const std::list<struct sockaddr_in> &filteredIPs)
|
||||
{
|
||||
// Nasty O(n^2) iteration over 500 entries!!!.
|
||||
// hope its not used to often.
|
||||
|
||||
std::list<struct sockaddr_in>::const_iterator it;
|
||||
for(it = filteredIPs.begin(); it != filteredIPs.end(); it++)
|
||||
{
|
||||
std::list<bdPeer>::iterator sit;
|
||||
for(sit = store.begin(); sit != store.end();)
|
||||
{
|
||||
if (it->sin_addr.s_addr == sit->mPeerId.addr.sin_addr.s_addr)
|
||||
{
|
||||
std::cerr << "bdStore::filterIpList() Found Bad entry in Store. Erasing!";
|
||||
std::cerr << std::endl;
|
||||
|
||||
sit = store.erase(sit);
|
||||
}
|
||||
else
|
||||
{
|
||||
sit++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define MAX_ENTRIES 500
|
||||
|
||||
/* maintain a sorted list */
|
||||
|
@ -219,3 +248,5 @@ void bdStore::writeStore()
|
|||
return writeStore(mStoreFile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue