---
plugins/curl.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/plugins/curl.c b/plugins/curl.c
index 41c4e2c..45d0a05 100644
--- a/plugins/curl.c
+++ b/plugins/curl.c
@@ -192,11 +192,13 @@ static int socket_callback(CURL *easy, curl_socket_t
sockfd, int what,
return 0;
}
+static int timer_callback(CURLM *multi, long timeout_ms, void *user_data);
static gboolean timeout_callback(gpointer user_data)
{
CURLM *multi = user_data;
CURLMcode result;
int handles;
+ long next_timer = -1;
DBG("");
@@ -209,6 +211,24 @@ static gboolean timeout_callback(gpointer user_data)
check_sockets(multi, result, handles);
+ /* Set up the next timer call; libcurl doesn't do it for us */
+ curl_multi_timeout(multi, &next_timer);
+
+ /* From the curl_multi_timeout() man page:
+ Note: if libcurl returns a -1 timeout here, it just means
+ that libcurl currently has no stored timeout value. You
+ must not wait too long (more than a few seconds perhaps)
+ before you call curl_multi_perform() again.
+
+ With curl < 7.21.2 it's very true; we'll never poll for
+ completion of the asynchronous DNS lookup otherwise.
+ */
+ if (next_timer == -1 && handles)
+ next_timer = 500;
+
+ if (next_timer != -1)
+ timer_callback(multi, next_timer, NULL);
+
return FALSE;
}
--
1.7.3.2
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman