lib/curl/{Global,Request}: migrate from DeferredMonitor to DeferEvent
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
#define CURL_REQUEST_HXX
|
||||
|
||||
#include "Easy.hxx"
|
||||
#include "event/DeferredMonitor.hxx"
|
||||
#include "event/DeferEvent.hxx"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
@@ -41,7 +41,7 @@ struct StringView;
|
||||
class CurlGlobal;
|
||||
class CurlResponseHandler;
|
||||
|
||||
class CurlRequest final : DeferredMonitor {
|
||||
class CurlRequest final {
|
||||
CurlGlobal &global;
|
||||
|
||||
CurlResponseHandler &handler;
|
||||
@@ -60,13 +60,15 @@ class CurlRequest final : DeferredMonitor {
|
||||
/**
|
||||
* An exception caught by DataReceived(), which will be
|
||||
* forwarded into a "safe" stack frame by
|
||||
* DeferredMonitor::RunDeferred(). This works around the
|
||||
* #postpone_error_event. This works around the
|
||||
* problem that libcurl crashes if you call
|
||||
* curl_multi_remove_handle() from within the WRITEFUNCTION
|
||||
* (i.e. DataReceived()).
|
||||
*/
|
||||
std::exception_ptr postponed_error;
|
||||
|
||||
DeferEvent postpone_error_event;
|
||||
|
||||
/** error message provided by libcurl */
|
||||
char error_buffer[CURL_ERROR_SIZE];
|
||||
|
||||
@@ -134,6 +136,8 @@ private:
|
||||
|
||||
void HeaderFunction(StringView s);
|
||||
|
||||
void OnPostponeError();
|
||||
|
||||
/** called by curl when new data is available */
|
||||
static size_t _HeaderFunction(void *ptr, size_t size, size_t nmemb,
|
||||
void *stream);
|
||||
@@ -141,9 +145,6 @@ private:
|
||||
/** called by curl when new data is available */
|
||||
static size_t WriteFunction(void *ptr, size_t size, size_t nmemb,
|
||||
void *stream);
|
||||
|
||||
/* virtual methods from class DeferredMonitor */
|
||||
void RunDeferred() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user