diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-11 16:58:24 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-11 16:58:24 +0000 |
| commit | 048a2cf59737f761876e81a77e8d064c45c752d7 (patch) | |
| tree | 65c9d5498aafe6a8c8e640ddfcc43c7013504d0d /src/AbstractCommand.h | |
| parent | e26bbbb9eee140ba24402fe872a752b42f0077de (diff) | |
2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented BitTorrent/http/ftp integrated download.
I've rewritten lots of files and now some headers have forward
class declarations to reduce compile time.
The implementation is extremely alpha stage, I recommend to use this
for testing purpose only.
Diffstat (limited to 'src/AbstractCommand.h')
| -rw-r--r-- | src/AbstractCommand.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/AbstractCommand.h b/src/AbstractCommand.h index 89f1d975..26fd4ddb 100644 --- a/src/AbstractCommand.h +++ b/src/AbstractCommand.h @@ -36,20 +36,24 @@ #define _D_ABSTRACT_COMMAND_H_ #include "Command.h" -#include "Request.h" -#include "DownloadEngine.h" -#include "SegmentMan.h" #include "TimeA2.h" -#include "RecoverableException.h" -#include "RequestGroup.h" +#include "RequestGroupAware.h" +#include "Socket.h" -class AbstractCommand : public Command { +class Request; +extern typedef SharedHandle<Request> RequestHandle; +class DownloadEngine; +class Segment; +extern typedef SharedHandle<Segment> SegmentHandle; +class NameResolver; +extern typedef SharedHandle<NameResolver> NameResolverHandle; + +class AbstractCommand : public Command, public RequestGroupAware { private: Time checkPoint; int32_t timeout; protected: RequestHandle req; - RequestGroup* _requestGroup; DownloadEngine* e; SocketHandle socket; SegmentHandle segment; @@ -70,12 +74,26 @@ protected: virtual bool nameResolveFinished() const; #endif // ENABLE_ASYNC_DNS void setTimeout(int32_t timeout) { this->timeout = timeout; } + + void loadAndOpenFile(); + + bool tryAutoFileRenaming(); + + void initPieceStorage(); + + bool downloadFinishedByFileLength(); + + void prepareForNextAction(Command* nextCommand = 0); + + void shouldCancelDownloadForSafety(); + private: bool checkSocketIsReadable; bool checkSocketIsWritable; SocketHandle readCheckTarget; SocketHandle writeCheckTarget; bool nameResolverCheck; + public: AbstractCommand(int32_t cuid, const RequestHandle& req, RequestGroup* requestGroup, DownloadEngine* e, const SocketHandle& s = SocketHandle()); virtual ~AbstractCommand(); |
