bitdht improvements

* Added bdHistory, to monitoring all the p2p dht messages (disabled normally)
 * cleaned up all compile warnings on OSX.
 * added Found timestamp to peer info.
 * disable save, until store is close to full.
 * ...?other stuff?



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3559 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2010-09-29 19:59:31 +00:00
parent 327af4ca61
commit c9229fb6e8
11 changed files with 447 additions and 38 deletions

View file

@ -94,7 +94,7 @@ int bdStore::getPeer(bdPeer *peer)
std::list<bdPeer>::iterator it;
int i = 0;
for(it = store.begin(); (it != store.end()) && (i < mIndex); it++, i++);
for(it = store.begin(); (it != store.end()) && (i < mIndex); it++, i++) ; /* empty loop */
if (it != store.end())
{
*peer = *it;
@ -161,6 +161,16 @@ void bdStore::writeStore(std::string file)
fprintf(stderr, "bdStore::writeStore(%s) = %d entries\n", file.c_str(), store.size());
#endif
if (store.size() < 0.9 * MAX_ENTRIES)
{
/* don't save yet! */
#ifdef DEBUG_STORE
fprintf(stderr, "bdStore::writeStore() Delaying until more entries\n");
#endif
return;
}
FILE *fd = fopen(file.c_str(), "w");
if (!fd)