mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -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
|
@ -27,6 +27,7 @@
|
|||
#include "bitdht/bdmanager.h"
|
||||
#include "bitdht/bdstddht.h"
|
||||
#include "udp/udplayer.h"
|
||||
#include "util/bdrandom.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -85,7 +86,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
for(j = 0; j < 2; j++)
|
||||
{
|
||||
int peeridx = rand() % n_nodes;
|
||||
int peeridx = bdRandom::random_u32() % n_nodes;
|
||||
for(i = 0, it = nodes.begin();
|
||||
(i < peeridx) && (it != nodes.end()); i++, it++)
|
||||
{
|
||||
|
@ -93,7 +94,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
if (it != nodes.end())
|
||||
{
|
||||
nit->second->addPotentialPeer((bdId *) &(it->first));
|
||||
nit->second->addPotentialPeer((bdId *) &(it->first), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "bitdht/bdnode.h"
|
||||
#include "bitdht/bdstddht.h"
|
||||
#include "util/bdrandom.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -87,10 +88,10 @@ int main(int argc, char **argv)
|
|||
|
||||
for(j = 0; j < 5; j++)
|
||||
{
|
||||
int peeridx = rand() % n_nodes;
|
||||
int peeridx = bdRand::random_u32() % n_nodes;
|
||||
|
||||
bdId pid = portIdx[peeridx];
|
||||
node->addPotentialPeer(&pid);
|
||||
node->addPotentialPeer(&pid, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ int main(int argc, char **argv)
|
|||
std::multimap<bdMetric, bdId> nearest;
|
||||
std::multimap<bdMetric, bdId>::iterator it;
|
||||
|
||||
space.find_nearest_nodes(&(queryId.id), N_PEERS_TO_START, startList, nearest);
|
||||
space.find_nearest_nodes(&(queryId.id), N_PEERS_TO_START, nearest);
|
||||
|
||||
for(it = nearest.begin(); it != nearest.end(); it++)
|
||||
{
|
||||
|
|
|
@ -56,10 +56,9 @@ int main(int argc, char **argv)
|
|||
{
|
||||
bdId tmpId;
|
||||
bdStdRandomId(&tmpId);
|
||||
std::list<bdId> list1;
|
||||
std::multimap<bdMetric, bdId> list2;
|
||||
|
||||
space.find_nearest_nodes(&(tmpId.id), N_PEERS_TO_FIND, list1, list2);
|
||||
space.find_nearest_nodes(&(tmpId.id), N_PEERS_TO_FIND, list2);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -72,8 +72,6 @@ int main(int argc, char **argv)
|
|||
bool doThreadJoin = false;
|
||||
int noQueries = 0;
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
while((c = getopt(argc, argv,"rjp:b:u:q:")) != -1)
|
||||
{
|
||||
switch (c)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue