From d558aae0bbc228caf6837309f2d9bfe18bb5a82e Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 12 Mar 2011 19:25:40 +0000 Subject: I hate this, but it helps to prevent stalling during early fetch stages with curl svn path=/trunk/netsurf/; revision=11986 --- content/fetchers/curl.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c index 86983ea28..56119bef1 100644 --- a/content/fetchers/curl.c +++ b/content/fetchers/curl.c @@ -51,6 +51,12 @@ #include "utils/ring.h" #include "utils/useragent.h" +/* BIG FAT WARNING: This is here because curl doesn't give you an FD to + * poll on, until it has processed a bit of the handle. So we need schedules + * in order to make this work. + */ +#include + /** SSL certificate info */ struct cert_info { X509 *cert; /**< Pointer to certificate */ @@ -440,7 +446,9 @@ bool fetch_curl_initiate_fetch(struct curl_fetch_info *fetch, CURL *handle) /* add to the global curl multi handle */ codem = curl_multi_add_handle(fetch_curl_multi, fetch->curl_handle); assert(codem == CURLM_OK || codem == CURLM_CALL_MULTI_PERFORM); - + + schedule(1, (schedule_callback_fn)fetch_curl_poll, NULL); + return true; } @@ -702,7 +710,9 @@ void fetch_curl_poll(const char *scheme_ignored) int running, queue; CURLMcode codem; CURLMsg *curl_msg; - + + schedule_remove((schedule_callback_fn)fetch_curl_poll, NULL); + /* do any possible work on the current fetches */ do { codem = curl_multi_perform(fetch_curl_multi, &running); -- cgit v1.2.3