aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-11-23 11:59:32 +0100
committerMax Kellermann <max@duempel.org>2013-11-23 12:13:41 +0100
commitd6247902eca44aa45f92ac095397738f7f633283 (patch)
tree636784f3b7e551045689d35b29e6645f329903fb /src
parenta566c28a49a72bf4dd2f33ad5ee0bf5635871550 (diff)
downloadmpd-d6247902eca44aa45f92ac095397738f7f633283.tar.gz
mpd-d6247902eca44aa45f92ac095397738f7f633283.tar.xz
mpd-d6247902eca44aa45f92ac095397738f7f633283.zip
input/curl: work around stream resume bug (fixed in libcurl 7.32.0)
Diffstat (limited to 'src')
-rw-r--r--src/input/CurlInputPlugin.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/input/CurlInputPlugin.cxx b/src/input/CurlInputPlugin.cxx
index b51fb99ac..b78545951 100644
--- a/src/input/CurlInputPlugin.cxx
+++ b/src/input/CurlInputPlugin.cxx
@@ -273,6 +273,16 @@ public:
SocketAction(CURL_SOCKET_TIMEOUT, 0);
}
+ /**
+ * This is a kludge to allow pausing/resuming a stream with
+ * libcurl < 7.32.0. Read the curl_easy_pause manpage for
+ * more information.
+ */
+ void ResumeSockets() {
+ int running_handles;
+ curl_multi_socket_all(multi, &running_handles);
+ }
+
private:
static int TimerFunction(CURLM *multi, long timeout_ms, void *userp);
@@ -335,6 +345,13 @@ input_curl_resume(struct input_curl *c)
if (c->paused) {
c->paused = false;
curl_easy_pause(c->easy, CURLPAUSE_CONT);
+
+ if (curl_version_num < 0x072000)
+ /* libcurl older than 7.32.0 does not update
+ its sockets after curl_easy_pause(); force
+ libcurl to do it now */
+ curl_multi->ResumeSockets();
+
curl_multi->InvalidateSockets();
}
}