/* */ #ifndef _D_BT_SEEDER_STATE_CHOKE_H_ #define _D_BT_SEEDER_STATE_CHOKE_H_ #include "common.h" #include #include "SharedHandle.h" #include "TimerA2.h" namespace aria2 { class Peer; class Logger; class BtSeederStateChoke { private: int round_; Timer lastRound_; Logger* logger_; class PeerEntry { private: SharedHandle peer_; size_t outstandingUpload_; Timer lastAmUnchoking_; bool recentUnchoking_; unsigned int uploadSpeed_; const static time_t TIME_FRAME = 20; public: PeerEntry(const SharedHandle& peer); bool operator<(const PeerEntry& rhs) const; const SharedHandle& getPeer() const { return peer_; } unsigned int getUploadSpeed() const { return uploadSpeed_; } void disableOptUnchoking(); }; void unchoke(std::vector& peers); class GenPeerEntry { public: PeerEntry operator()(const SharedHandle& peer) const { return PeerEntry(peer); } }; class NotInterestedPeer { public: bool operator()(const PeerEntry& peerEntry) const; }; public: BtSeederStateChoke(); ~BtSeederStateChoke(); void executeChoke(const std::vector >& peerSet); const Timer& getLastRound() const { return lastRound_; } }; } // namespace aria2 #endif // _D_BT_SEEDER_STATE_CHOKE_H_