/* */ #ifndef _D_ACTIVE_PEER_CONNECTION_COMMAND_H_ #define _D_ACTIVE_PEER_CONNECTION_COMMAND_H_ #include "Command.h" #include "SharedHandle.h" #include "RequestGroupAware.h" #include "TimeA2.h" namespace aria2 { class DownloadEngine; class Peer; class BtContext; class BtRuntime; class PieceStorage; class PeerStorage; class BtAnnounce; class ActivePeerConnectionCommand : public Command, public RequestGroupAware { private: SharedHandle _btContext; SharedHandle _btRuntime; SharedHandle _pieceStorage; SharedHandle _peerStorage; SharedHandle _btAnnounce; time_t interval; // UNIT: sec DownloadEngine* e; Time checkPoint; unsigned int _thresholdSpeed; // UNIT: byte/sec unsigned int _maxUploadSpeedLimit; unsigned int _numNewConnection; // the number of the connection to establish. public: ActivePeerConnectionCommand(int cuid, RequestGroup* requestGroup, DownloadEngine* e, const SharedHandle& btContext, time_t interval); virtual ~ActivePeerConnectionCommand(); virtual bool execute(); void connectToPeer(const SharedHandle& peer); void setNumNewConnection(size_t numNewConnection) { _numNewConnection = numNewConnection; } void setBtRuntime(const SharedHandle& btRuntime); void setPieceStorage(const SharedHandle& pieceStorage); void setPeerStorage(const SharedHandle& peerStorage); void setBtAnnounce(const SharedHandle& btAnnounce); }; } // namespace aria2 #endif // _D_ACTIVE_PEER_CONNECTION_COMMAND_H_