diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-11-13 11:46:58 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-11-13 11:46:58 +0000 |
| commit | 3adebc4d451655d7607706bfbe9712993a8f0047 (patch) | |
| tree | 16d9cba9d4066a76663d23a04744883356d638b0 /src/HttpResponseCommand.cc | |
| parent | d6686a5e29234a518e8bda4e1f790df6ea48e976 (diff) | |
2007-11-13 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added the ability to detect duplicate download entry which is
about to
download the same file other RequestGroup is downloading.
* src/RequestGroup.cc
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
Diffstat (limited to 'src/HttpResponseCommand.cc')
| -rw-r--r-- | src/HttpResponseCommand.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc index adfb63a8..a7d62346 100644 --- a/src/HttpResponseCommand.cc +++ b/src/HttpResponseCommand.cc @@ -49,6 +49,8 @@ #include "DiskAdaptor.h" #include "PieceStorage.h" #include "DefaultBtProgressInfoFile.h" +#include "RequestGroupMan.h" +#include "DownloadFailureException.h" #include <sys/types.h> #include <unistd.h> @@ -91,6 +93,10 @@ bool HttpResponseCommand::executeInternal() SingleFileDownloadContextHandle dctx = _requestGroup->getDownloadContext(); dctx->setTotalLength(totalLength); dctx->setFilename(httpResponse->determinFilename()); + if(e->_requestGroupMan->isSameFileBeingDownloaded(_requestGroup)) { + throw new DownloadFailureException(EX_DUPLICATE_FILE_DOWNLOAD, + _requestGroup->getFilePath().c_str()); + } if(totalLength == 0 || httpResponse->isTransferEncodingSpecified()) { // we ignore content-length when transfer-encoding is set dctx->setTotalLength(0); |
