diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index 7f376429e8a..cd11f19f8ef 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -30,8 +30,6 @@ #include #include -using namespace std::string_literals; - namespace nix { const unsigned int RETRY_TIME_MS_DEFAULT = 250; @@ -77,8 +75,9 @@ struct curlFileTransfer : public FileTransfer CURL * req = 0; // buffer to accompany the `req` above char errbuf[CURL_ERROR_SIZE]; - bool active = false; // whether the handle has been added to the multi object - bool paused = false; // whether the request has been paused previously + bool active = false; // whether the handle has been added to the multi object + bool paused = false; // whether the request has been paused previously + bool enqueued = false; // whether the request has been added the incoming queue std::string statusMsg; unsigned int attempt = 0; @@ -176,7 +175,7 @@ struct curlFileTransfer : public FileTransfer curl_easy_cleanup(req); } try { - if (!done) + if (!done && enqueued) fail(FileTransferError( Interrupted, {}, "%s of '%s' was interrupted", Uncolored(request.noun()), request.uri)); } catch (...) { @@ -887,6 +886,7 @@ struct curlFileTransfer : public FileTransfer if (state->isQuitting()) throw nix::Error("cannot enqueue download request because the download thread is shutting down"); state->incoming.push(item); + item->enqueued = true; /* Now any exceptions should be reported via the callback. */ } wakeupMulti();