From 692c4eaf3e30b27855ebd95308b3655652f8912d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 14 May 2009 13:48:26 +0000 Subject: [PATCH] 2009-05-14 Tatsuhiro Tsujikawa Added purgeDownloadResult command. * src/RequestGroupMan.cc * src/RequestGroupMan.h * src/XmlRpcMethodFactory.cc * src/XmlRpcMethodImpl.cc * src/XmlRpcMethodImpl.h --- ChangeLog | 9 +++++++++ src/RequestGroupMan.cc | 5 +++++ src/RequestGroupMan.h | 3 +++ src/XmlRpcMethodFactory.cc | 2 ++ src/XmlRpcMethodImpl.cc | 7 +++++++ src/XmlRpcMethodImpl.h | 5 +++++ 6 files changed, 31 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6b8a41cd..615aaa41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-05-14 Tatsuhiro Tsujikawa + + Added purgeDownloadResult command. + * src/RequestGroupMan.cc + * src/RequestGroupMan.h + * src/XmlRpcMethodFactory.cc + * src/XmlRpcMethodImpl.cc + * src/XmlRpcMethodImpl.h + 2009-05-14 Tatsuhiro Tsujikawa Refactored. diff --git a/src/RequestGroupMan.cc b/src/RequestGroupMan.cc index 3a30d7d4..2fd45f63 100644 --- a/src/RequestGroupMan.cc +++ b/src/RequestGroupMan.cc @@ -696,6 +696,11 @@ RequestGroupMan::findDownloadResult(int32_t gid) const return SharedHandle(); } +void RequestGroupMan::purgeDownloadResult() +{ + _downloadResults.clear(); +} + SharedHandle RequestGroupMan::findServerStat(const std::string& hostname, const std::string& protocol) const diff --git a/src/RequestGroupMan.h b/src/RequestGroupMan.h index 8cda1693..2c2629f3 100644 --- a/src/RequestGroupMan.h +++ b/src/RequestGroupMan.h @@ -169,6 +169,9 @@ public: SharedHandle findDownloadResult(int32_t gid) const; + // Removes all download results. + void purgeDownloadResult(); + SharedHandle findServerStat(const std::string& hostname, const std::string& protocol) const; diff --git a/src/XmlRpcMethodFactory.cc b/src/XmlRpcMethodFactory.cc index f54c14c3..280d47af 100644 --- a/src/XmlRpcMethodFactory.cc +++ b/src/XmlRpcMethodFactory.cc @@ -62,6 +62,8 @@ XmlRpcMethodFactory::create(const std::string& methodName) return SharedHandle(new GetPeersXmlRpcMethod()); } else if(methodName == "aria2.tellActive") { return SharedHandle(new TellActiveXmlRpcMethod()); + } else if(methodName == "aria2.purgeDownloadResult") { + return SharedHandle(new PurgeDownloadResultXmlRpcMethod()); } else { return SharedHandle(new NoSuchMethodXmlRpcMethod()); } diff --git a/src/XmlRpcMethodImpl.cc b/src/XmlRpcMethodImpl.cc index fc7f5559..c542c1de 100644 --- a/src/XmlRpcMethodImpl.cc +++ b/src/XmlRpcMethodImpl.cc @@ -452,6 +452,13 @@ BDE TellActiveXmlRpcMethod::process return list; } +BDE PurgeDownloadResultXmlRpcMethod::process +(const XmlRpcRequest& req, DownloadEngine* e) +{ + e->_requestGroupMan->purgeDownloadResult(); + return BDE("OK"); +} + BDE NoSuchMethodXmlRpcMethod::process (const XmlRpcRequest& req, DownloadEngine* e) { diff --git a/src/XmlRpcMethodImpl.h b/src/XmlRpcMethodImpl.h index ed377df6..142cb2c7 100644 --- a/src/XmlRpcMethodImpl.h +++ b/src/XmlRpcMethodImpl.h @@ -61,6 +61,11 @@ protected: virtual BDE process(const XmlRpcRequest& req, DownloadEngine* e); }; +class PurgeDownloadResultXmlRpcMethod:public XmlRpcMethod { +protected: + virtual BDE process(const XmlRpcRequest& req, DownloadEngine* e); +}; + class GetUrisXmlRpcMethod:public XmlRpcMethod { protected: virtual BDE process(const XmlRpcRequest& req, DownloadEngine* e);