summaryrefslogtreecommitdiff
path: root/src/CreateRequestCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-08-31 22:31:31 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-08-31 22:31:31 +0900
commit0bbda43385c5e660a3365830d0b020e1a8f99970 (patch)
tree7f4199b30393e3d6a2b42316e58003103531ac8d /src/CreateRequestCommand.cc
parentd59300d582a36692e55448246f97246fc13d41f3 (diff)
Fixed assertion error if --retry-wait is used
In CreateRequestCommand, if Request object returned from getRequest() is still sleeping, CreateRequestCommand pools it back but still holds its reference. This makes assertion error in UnknownLengthPieceStroage::hasMissingUnusedPiece() from AbstractCommand::execute().
Diffstat (limited to 'src/CreateRequestCommand.cc')
-rw-r--r--src/CreateRequestCommand.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/CreateRequestCommand.cc b/src/CreateRequestCommand.cc
index 21edc397..d46936dd 100644
--- a/src/CreateRequestCommand.cc
+++ b/src/CreateRequestCommand.cc
@@ -101,6 +101,10 @@ bool CreateRequestCommand::executeInternal()
} else if(getRequest()->getWakeTime() > global::wallclock()) {
A2_LOG_DEBUG("This request object is still sleeping.");
getFileEntry()->poolRequest(getRequest());
+ // Reset request of this command. Without this, request is doubly
+ // counted (1 for pooled and another one in this command) and
+ // AbstractCommand::execute() will behave badly.
+ resetRequest();
getDownloadEngine()->addCommand(this);
return false;
}