/* */ #ifndef _D_ACTIVE_PEER_CONNECTION_COMMAND_H_ #define _D_ACTIVE_PEER_CONNECTION_COMMAND_H_ #include "BtContextAwareCommand.h" #include "TorrentDownloadEngine.h" #include "TimeA2.h" class ActivePeerConnectionCommand : public BtContextAwareCommand { private: int32_t interval; // UNIT: sec TorrentDownloadEngine* e; Time checkPoint; int32_t _lowestSpeedLimit; // UNIT: byte/sec int32_t _numNewConnection; // the number of the connection to establish. public: ActivePeerConnectionCommand(int cuid, TorrentDownloadEngine* e, const BtContextHandle& btContext, int32_t interval) :BtContextAwareCommand(cuid, btContext), interval(interval), e(e), _lowestSpeedLimit(20*1024), _numNewConnection(5) {} virtual ~ActivePeerConnectionCommand() {} virtual bool execute(); void connectToPeer(const PeerHandle& peer); void setLowestSpeedLimit(int32_t speed) { _lowestSpeedLimit = speed; } void setNumNewConnection(int32_t numNewConnection) { _numNewConnection = numNewConnection; } }; #endif // _D_ACTIVE_PEER_CONNECTION_COMMAND_H_