aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/CurlInputPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-10 11:21:38 +0200
committerMax Kellermann <max@duempel.org>2013-08-10 11:52:31 +0200
commit84ac79bb08696230157912a1d927d35004b12e8c (patch)
tree857369be445009e0368e4123d1aea8b03411b4d1 /src/input/CurlInputPlugin.cxx
parentbe0c8495cdb60847279ffbb6b6e1c1efed607e98 (diff)
downloadmpd-84ac79bb08696230157912a1d927d35004b12e8c.tar.gz
mpd-84ac79bb08696230157912a1d927d35004b12e8c.tar.xz
mpd-84ac79bb08696230157912a1d927d35004b12e8c.zip
event/MultiSocketMonitor: eliminate virtual method CheckSockets()
Handle timeout internally.
Diffstat (limited to '')
-rw-r--r--src/input/CurlInputPlugin.cxx28
1 files changed, 0 insertions, 28 deletions
diff --git a/src/input/CurlInputPlugin.cxx b/src/input/CurlInputPlugin.cxx
index 56a42709a..c5f524bc0 100644
--- a/src/input/CurlInputPlugin.cxx
+++ b/src/input/CurlInputPlugin.cxx
@@ -183,18 +183,6 @@ struct input_curl {
* This class monitors all CURL file descriptors.
*/
class CurlSockets final : private MultiSocketMonitor {
- /**
- * Did CURL give us a timeout? If yes, then we need to call
- * curl_multi_perform(), even if there was no event on any
- * file descriptor.
- */
- bool have_timeout;
-
- /**
- * The absolute time stamp when the timeout expires.
- */
- gint64 absolute_timeout;
-
public:
CurlSockets(EventLoop &_loop)
:MultiSocketMonitor(_loop) {}
@@ -205,7 +193,6 @@ private:
void UpdateSockets();
virtual int PrepareSockets() override;
- virtual bool CheckSockets() const override;
virtual void DispatchSockets() override;
};
@@ -541,14 +528,9 @@ CurlSockets::PrepareSockets()
{
UpdateSockets();
- have_timeout = false;
-
long timeout2;
CURLMcode mcode = curl_multi_timeout(curl.multi, &timeout2);
if (mcode == CURLM_OK) {
- if (timeout2 >= 0)
- absolute_timeout = GetTime() + timeout2 * 1000;
-
if (timeout2 >= 0 && timeout2 < 10)
/* CURL 7.21.1 likes to report "timeout=0",
which means we're running in a busy loop.
@@ -556,7 +538,6 @@ CurlSockets::PrepareSockets()
Let's use a lower limit of 10ms. */
timeout2 = 10;
- have_timeout = timeout2 >= 0;
return timeout2;
} else {
g_warning("curl_multi_timeout() failed: %s\n",
@@ -565,15 +546,6 @@ CurlSockets::PrepareSockets()
}
}
-bool
-CurlSockets::CheckSockets() const
-{
- /* when a timeout has expired, we need to call
- curl_multi_perform(), even if there was no file descriptor
- event */
- return have_timeout && GetTime() >= absolute_timeout;
-}
-
void
CurlSockets::DispatchSockets()
{