Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/libstore/filetransfer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
#include <thread>
#include <regex>

using namespace std::string_literals;

namespace nix {

const unsigned int RETRY_TIME_MS_DEFAULT = 250;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 (...) {
Expand Down Expand Up @@ -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();
Expand Down
Loading