storage/curl: migrate from DeferredMonitor to DeferEvent
This commit is contained in:
parent
42ad753e39
commit
ec20784046
@ -31,7 +31,7 @@
|
||||
#include "lib/expat/ExpatParser.hxx"
|
||||
#include "fs/Traits.hxx"
|
||||
#include "event/Call.hxx"
|
||||
#include "event/DeferredMonitor.hxx"
|
||||
#include "event/DeferEvent.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "thread/Cond.hxx"
|
||||
#include "util/ChronoUtil.hxx"
|
||||
@ -88,7 +88,9 @@ CurlStorage::MapToRelativeUTF8(const char *uri_utf8) const noexcept
|
||||
return PathTraitsUTF8::Relative(base.c_str(), uri_utf8);
|
||||
}
|
||||
|
||||
class BlockingHttpRequest : protected CurlResponseHandler, DeferredMonitor {
|
||||
class BlockingHttpRequest : protected CurlResponseHandler {
|
||||
DeferEvent defer_start;
|
||||
|
||||
std::exception_ptr postponed_error;
|
||||
|
||||
bool done = false;
|
||||
@ -101,12 +103,13 @@ protected:
|
||||
|
||||
public:
|
||||
BlockingHttpRequest(CurlGlobal &curl, const char *uri)
|
||||
:DeferredMonitor(curl.GetEventLoop()),
|
||||
:defer_start(curl.GetEventLoop(),
|
||||
BIND_THIS_METHOD(OnDeferredStart)),
|
||||
request(curl, uri, *this) {
|
||||
// TODO: use CurlInputStream's configuration
|
||||
|
||||
/* start the transfer inside the IOThread */
|
||||
DeferredMonitor::Schedule();
|
||||
defer_start.Schedule();
|
||||
}
|
||||
|
||||
void Wait() {
|
||||
@ -133,8 +136,8 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
/* virtual methods from DeferredMonitor */
|
||||
void RunDeferred() final {
|
||||
/* DeferEvent callback */
|
||||
void OnDeferredStart() noexcept {
|
||||
assert(!done);
|
||||
|
||||
request.Start();
|
||||
|
Loading…
Reference in New Issue
Block a user