lib/curl/Global: defer the ReadInfo() call
Fixes a crash that can occur due to recursion from InvalidateSockets() to ReadInfo() to CurlRequest callbacks.
This commit is contained in:
parent
218c3bc0d5
commit
3c66feff5a
2
NEWS
2
NEWS
|
@ -1,4 +1,6 @@
|
|||
ver 0.20.1 (not yet released)
|
||||
* input
|
||||
- curl: fix crash bug
|
||||
* mixer
|
||||
- alsa: normalize displayed volume according to human perception
|
||||
* fix crash with volume_normalization enabled
|
||||
|
|
|
@ -96,7 +96,7 @@ private:
|
|||
};
|
||||
|
||||
CurlGlobal::CurlGlobal(EventLoop &_loop)
|
||||
:TimeoutMonitor(_loop)
|
||||
:TimeoutMonitor(_loop), DeferredMonitor(_loop)
|
||||
{
|
||||
multi.SetOption(CURLMOPT_SOCKETFUNCTION, CurlSocket::SocketFunction);
|
||||
multi.SetOption(CURLMOPT_SOCKETDATA, this);
|
||||
|
@ -262,5 +262,11 @@ CurlGlobal::SocketAction(curl_socket_t fd, int ev_bitmask)
|
|||
"curl_multi_socket_action() failed: %s",
|
||||
curl_multi_strerror(mcode));
|
||||
|
||||
DeferredMonitor::Schedule();
|
||||
}
|
||||
|
||||
void
|
||||
CurlGlobal::RunDeferred()
|
||||
{
|
||||
ReadInfo();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "Multi.hxx"
|
||||
#include "event/TimeoutMonitor.hxx"
|
||||
#include "event/DeferredMonitor.hxx"
|
||||
|
||||
class CurlSocket;
|
||||
class CurlRequest;
|
||||
|
@ -39,7 +40,7 @@ class CurlRequest;
|
|||
/**
|
||||
* Manager for the global CURLM object.
|
||||
*/
|
||||
class CurlGlobal final : private TimeoutMonitor {
|
||||
class CurlGlobal final : TimeoutMonitor, DeferredMonitor {
|
||||
CurlMulti multi;
|
||||
|
||||
public:
|
||||
|
@ -81,6 +82,9 @@ private:
|
|||
|
||||
/* virtual methods from class TimeoutMonitor */
|
||||
void OnTimeout() override;
|
||||
|
||||
/* virtual methods from class DeferredMonitor */
|
||||
void RunDeferred() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue