/* */ #ifndef _D_ABSTRACT_COMMAND_H_ #define _D_ABSTRACT_COMMAND_H_ #include "Command.h" #include "Request.h" #include "DownloadEngine.h" #include "SegmentMan.h" #include class AbstractCommand : public Command { private: void updateCheckPoint(); bool isTimeoutDetected(); struct timeval checkPoint; protected: Request* req; DownloadEngine* e; Socket* socket; virtual bool prepareForRetry(int wait); virtual void onAbort(Exception* ex); virtual bool executeInternal(Segment segment) = 0; void setReadCheckSocket(Socket* socket); void setWriteCheckSocket(Socket* socket); private: bool checkSocketIsReadable; bool checkSocketIsWritable; Socket* readCheckTarget; Socket* writeCheckTarget; public: AbstractCommand(int cuid, Request* req, DownloadEngine* e, Socket* s= NULL); virtual ~AbstractCommand(); bool execute(); }; #endif // _D_ABSTRACT_COMMAND_H_