Merge branch 'nix-repl-download-interruption' of https://github.com/Ma27/nix
This commit is contained in:
commit
3a778ea8a0
2 changed files with 21 additions and 2 deletions
|
@ -716,15 +716,32 @@ struct curlFileTransfer : public FileTransfer
|
|||
}
|
||||
};
|
||||
|
||||
ref<curlFileTransfer> makeCurlFileTransfer()
|
||||
{
|
||||
return make_ref<curlFileTransfer>();
|
||||
}
|
||||
|
||||
ref<FileTransfer> getFileTransfer()
|
||||
{
|
||||
static ref<FileTransfer> fileTransfer = makeFileTransfer();
|
||||
static ref<curlFileTransfer> fileTransfer = makeCurlFileTransfer();
|
||||
|
||||
// this has to be done in its own scope to make sure that the lock is released
|
||||
// before creating a new fileTransfer instance.
|
||||
auto needsRecreation = [&]() -> bool {
|
||||
auto state = fileTransfer->state_.lock();
|
||||
return state->quit;
|
||||
};
|
||||
|
||||
if (needsRecreation()) {
|
||||
fileTransfer = makeCurlFileTransfer();
|
||||
}
|
||||
|
||||
return fileTransfer;
|
||||
}
|
||||
|
||||
ref<FileTransfer> makeFileTransfer()
|
||||
{
|
||||
return make_ref<curlFileTransfer>();
|
||||
return makeCurlFileTransfer();
|
||||
}
|
||||
|
||||
std::future<FileTransferResult> FileTransfer::enqueueFileTransfer(const FileTransferRequest & request)
|
||||
|
|
|
@ -396,6 +396,8 @@ bool NixRepl::processLine(string line)
|
|||
{
|
||||
if (line == "") return true;
|
||||
|
||||
_isInterrupted = false;
|
||||
|
||||
string command, arg;
|
||||
|
||||
if (line[0] == ':') {
|
||||
|
|
Loading…
Reference in a new issue