This commit is contained in:
Eelco Dolstra 2021-10-12 16:43:00 +02:00
parent 3a778ea8a0
commit 5176b072ed

View file

@ -725,16 +725,8 @@ ref<FileTransfer> getFileTransfer()
{
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()) {
if (fileTransfer->state_.lock()->quit)
fileTransfer = makeCurlFileTransfer();
}
return fileTransfer;
}