aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/curl_input_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-07-20 23:03:06 +0200
committerMax Kellermann <max@duempel.org>2010-07-20 23:03:06 +0200
commitc0da938d4f9e6b15cc5cca80090a15aa89ff3d2b (patch)
treead9b4d900e4aa34b2c587423911c19f7d84cdde8 /src/input/curl_input_plugin.c
parentfb19aa355e566898fcb18bf3a5700a8e5f236696 (diff)
parent0fec8e08641470fdcaeb68fc362f77ca78925011 (diff)
downloadmpd-c0da938d4f9e6b15cc5cca80090a15aa89ff3d2b.tar.gz
mpd-c0da938d4f9e6b15cc5cca80090a15aa89ff3d2b.tar.xz
mpd-c0da938d4f9e6b15cc5cca80090a15aa89ff3d2b.zip
Merge release 0.15.12 from branch 'v0.15.x'
Conflicts: NEWS configure.ac
Diffstat (limited to '')
-rw-r--r--src/input/curl_input_plugin.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c
index 839c98074..f1c54cdbe 100644
--- a/src/input/curl_input_plugin.c
+++ b/src/input/curl_input_plugin.c
@@ -245,7 +245,6 @@ input_curl_select(struct input_curl *c, GError **error_r)
fd_set rfds, wfds, efds;
int max_fd, ret;
CURLMcode mcode;
- /* XXX hard coded timeout value.. */
struct timeval timeout = {
.tv_sec = 1,
.tv_usec = 0,
@@ -265,7 +264,23 @@ input_curl_select(struct input_curl *c, GError **error_r)
return -1;
}
- assert(max_fd >= 0);
+#if LIBCURL_VERSION_NUM >= 0x070f00
+ long timeout2;
+ mcode = curl_multi_timeout(c->multi, &timeout2);
+ if (mcode != CURLM_OK) {
+ g_warning("curl_multi_timeout() failed: %s\n",
+ curl_multi_strerror(mcode));
+ return -1;
+ }
+
+ if (timeout2 >= 0) {
+ if (timeout2 > 10000)
+ timeout2 = 10000;
+
+ timeout.tv_sec = timeout2 / 1000;
+ timeout.tv_usec = (timeout2 % 1000) * 1000;
+ }
+#endif
ret = select(max_fd + 1, &rfds, &wfds, &efds, &timeout);
if (ret < 0)