/* */ #ifndef D_BT_SEEDER_STATE_CHOKE_H #define D_BT_SEEDER_STATE_CHOKE_H #include "common.h" #include #include #include "TimerA2.h" #include "PeerStorage.h" namespace aria2 { class Peer; class BtSeederStateChoke { private: int round_; Timer lastRound_; class PeerEntry { private: std::shared_ptr peer_; size_t outstandingUpload_; Timer lastAmUnchoking_; bool recentUnchoking_; int uploadSpeed_; public: PeerEntry(const std::shared_ptr& peer); PeerEntry(const PeerEntry& c); ~PeerEntry(); void swap(PeerEntry& c); PeerEntry& operator=(const PeerEntry& c); bool operator<(const PeerEntry& rhs) const; const std::shared_ptr& getPeer() const { return peer_; } int getUploadSpeed() const { return uploadSpeed_; } void disableOptUnchoking(); }; void unchoke(std::vector& peers); public: BtSeederStateChoke(); ~BtSeederStateChoke(); void executeChoke(const PeerSet& peerSet); const Timer& getLastRound() const { return lastRound_; } friend void swap(PeerEntry& a, PeerEntry& b); }; void swap(BtSeederStateChoke::PeerEntry& a, BtSeederStateChoke::PeerEntry& b); } // namespace aria2 #endif // D_BT_SEEDER_STATE_CHOKE_H