diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-06-16 15:11:41 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-06-16 15:11:41 +0000 |
| commit | 1c2dd30bf74200e1033fcb09ceec22a4e1f34e05 (patch) | |
| tree | a21fa68650587760b4934ed7219bc7328fa464a6 /src/AbstractDiskWriter.cc | |
| parent | 953d1683a34541e6c58fa4b99ffdbe06376666fc (diff) | |
2008-06-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
When there is not enough space in disk when writing a chunk of
data,
aria2 now prints the message to the console to warn user and
aborts
its download. Not all downloads are canceled because some
downloads
may use another disk or partition. BUG#1640332
* src/AbstractDiskWriter.cc
* src/PeerAbstractCommand.cc
* src/PeerAbstractCommand.h: Added onFailure() function for
override.
* src/PeerInteractionCommand.cc: In onFailure(), call
RequestGroup::
setHaltRequested(true) to cancel download.
* src/PeerInteractionCommand.h
Diffstat (limited to 'src/AbstractDiskWriter.cc')
| -rw-r--r-- | src/AbstractDiskWriter.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/AbstractDiskWriter.cc b/src/AbstractDiskWriter.cc index 1b86da28..afc3b7b7 100644 --- a/src/AbstractDiskWriter.cc +++ b/src/AbstractDiskWriter.cc @@ -41,6 +41,7 @@ #include "DlAbortEx.h" #include "a2io.h" #include "StringFormat.h" +#include "DownloadFailureException.h" #include <cerrno> #include <cstring> #include <cassert> @@ -133,6 +134,12 @@ void AbstractDiskWriter::writeData(const unsigned char* data, size_t len, off_t { seek(offset); if(writeDataInternal(data, len) < 0) { + // If errno is ENOSPC(not enough space in device), throw + // DownloadFailureException and abort download instantly. + if(errno == ENOSPC) { + throw DownloadFailureException + (StringFormat(EX_FILE_WRITE, filename.c_str(), strerror(errno)).str()); + } throw DlAbortEx(StringFormat(EX_FILE_WRITE, filename.c_str(), strerror(errno)).str()); } } |
