* Added new interface functions for start / stop DHT and to get stats.

* Implemented start/stop interface in udpbitdht and bemanager
 * added Restart of DHT if it fails to get going.
 * added start / stop functionality to bdnode and bdstore
 * added cleanup code to rest of bitdht classes.
 * reworked NetworkSize calc functions.
 * added thread debugging (prints at start / stop / join).
 * TESTS: added utest.h header file for automated unit testing (from libretroshare)
 * TESTS: bdmetric_test started conversion to automated tests
 * TESTS: udpbitdht_nettest. Added dht start / stop and network reset (thread join) functionality.
 * TESTS: fresh bdboot.txt



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3678 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2010-10-17 20:55:32 +00:00
parent 884f0e7a22
commit 74961774cc
18 changed files with 1193 additions and 601 deletions

View file

@ -41,14 +41,27 @@ bdStore::bdStore(std::string file, bdDhtFunctions *fns)
#endif
/* read data from file */
mIndex = 0;
mStoreFile = file;
FILE *fd = fopen(file.c_str(), "r");
reloadFromStore();
}
int bdStore::clear()
{
mIndex = 0;
store.clear();
return 1;
}
int bdStore::reloadFromStore()
{
clear();
FILE *fd = fopen(mStoreFile.c_str(), "r");
if (!fd)
{
fprintf(stderr, "Failed to Open File: %s ... No Peers\n", file.c_str());
return;
fprintf(stderr, "Failed to Open File: %s ... No Peers\n", mStoreFile.c_str());
return 0;
}
@ -84,6 +97,8 @@ bdStore::bdStore(std::string file, bdDhtFunctions *fns)
fprintf(stderr, "Read %ld Peers\n", (long) store.size());
#endif
return 1;
}
int bdStore::getPeer(bdPeer *peer)