From ec20784046cf12d590c6c19eeedf536f14415d3e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 10 Nov 2017 21:10:54 +0100 Subject: [PATCH] storage/curl: migrate from DeferredMonitor to DeferEvent --- src/storage/plugins/CurlStorage.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/storage/plugins/CurlStorage.cxx b/src/storage/plugins/CurlStorage.cxx index 082c62342..7f508f178 100644 --- a/src/storage/plugins/CurlStorage.cxx +++ b/src/storage/plugins/CurlStorage.cxx @@ -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();