removed out-of-date function from bdpeers.

added protection for WIN32 in bdbloom #include <malloc>



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-peernet@4396 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-07-05 23:49:28 +00:00
parent d51e755ac0
commit c0a6c002c3
2 changed files with 3 additions and 74 deletions

View File

@ -437,80 +437,6 @@ int bdSpace::find_exactnode(const bdId *id, bdPeer &peer)
}
#if 0
int bdSpace::out_of_date_peer(bdId &id)
{
/*
*
*/
std::map<bdMetric, bdId> closest;
std::map<bdMetric, bdId>::iterator mit;
std::vector<bdBucket>::iterator it;
std::list<bdPeer>::iterator eit;
time_t ts = time(NULL);
/* iterate through the buckets, and sort by distance */
for(it = buckets.begin(); it != buckets.end(); it++)
{
for(eit = it->entries.begin(); eit != it->entries.end(); )
{
/* timeout on last send time! */
if (ts - eit->mLastSendTime > BITDHT_MAX_SEND_PERIOD )
{
/* We want to ping a peer iff:
* 1) They are out-of-date: mLastRecvTime is too old.
* 2) They don't have 0x0001 flag (we haven't received a PONG) and never sent.
*/
if ((ts - eit->mLastRecvTime > BITDHT_MAX_SEND_PERIOD ) ||
!(eit->mPeerFlags & BITDHT_PEER_STATUS_RECV_PONG))
{
id = eit->mPeerId;
eit->mLastSendTime = ts;
return 1;
}
}
/* we also want to remove very old entries (should it happen here?)
* which are not pushed out by newer entries (will happen in for closer buckets)
*/
bool discard = false;
/* discard very old entries */
if (ts - eit->mLastRecvTime > BITDHT_DISCARD_PERIOD)
{
discard = true;
}
/* discard peers which have not responded to anything (ie have no flags set) */
if ((ts - eit->mFoundTime > BITDHT_MAX_RESPONSE_PERIOD ) &&
(eit->mPeerFlags == 0))
{
discard = true;
}
/* INCREMENT */
if (discard)
{
eit = it->entries.erase(eit);
}
else
{
eit++;
}
}
}
return 0;
}
#endif
#define BITDHT_ATTACHED_SEND_PERIOD 17
int bdSpace::scanOutOfDatePeers(std::list<bdId> &peerIds)

View File

@ -28,7 +28,10 @@
#include <stdlib.h>
#include <sstream>
#include <iomanip>
#if defined(_WIN32) || defined(__MINGW32__)
#include <malloc.h>
#endif
/* Bloom Filter implementation */