diff --git a/libbitdht/src/bitdht/bdpeer.cc b/libbitdht/src/bitdht/bdpeer.cc index cd58389a0..de2432926 100644 --- a/libbitdht/src/bitdht/bdpeer.cc +++ b/libbitdht/src/bitdht/bdpeer.cc @@ -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 closest; - std::map::iterator mit; - - std::vector::iterator it; - std::list::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 &peerIds) diff --git a/libbitdht/src/util/bdbloom.cc b/libbitdht/src/util/bdbloom.cc index 60997c4e7..4c44f3ea5 100644 --- a/libbitdht/src/util/bdbloom.cc +++ b/libbitdht/src/util/bdbloom.cc @@ -28,7 +28,10 @@ #include #include #include + +#if defined(_WIN32) || defined(__MINGW32__) #include +#endif /* Bloom Filter implementation */