libstore: explicitly init curl transfer sources
this too will make it easier to make the streams async. Change-Id: I9a961fc667042e0aed23d2241326f1ea719bc7a4
This commit is contained in:
@@ -801,6 +801,7 @@ struct curlFileTransfer : public FileTransfer
|
||||
}
|
||||
|
||||
auto source = make_box_ptr<TransferSource>(*this, uri, headers, std::move(data), noBody);
|
||||
source->init();
|
||||
source->awaitData();
|
||||
co_return {source->metadata, std::move(source)};
|
||||
} catch (...) {
|
||||
@@ -838,8 +839,6 @@ struct curlFileTransfer : public FileTransfer
|
||||
, data(std::move(data))
|
||||
, noBody(noBody)
|
||||
{
|
||||
auto setup = [&] { return startTransfer(uri); };
|
||||
metadata = withRetries(setup, setup);
|
||||
}
|
||||
|
||||
~TransferSource()
|
||||
@@ -854,6 +853,12 @@ struct curlFileTransfer : public FileTransfer
|
||||
}
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
auto setup = [&] { return startTransfer(uri); };
|
||||
metadata = withRetries(setup, setup);
|
||||
}
|
||||
|
||||
auto withRetries(auto && initial, auto && retry) -> decltype(initial())
|
||||
{
|
||||
std::optional<std::string> retryContext;
|
||||
|
||||
Reference in New Issue
Block a user