From 4b2101ba6ab62ae26d82cc8b86e0e61e9c007156 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 19 Jun 2014 18:27:24 +0100 Subject: clean up the fetcher factory and improve its API --- content/fetchers/curl.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'content/fetchers/curl.c') diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c index 80ac5ec89..39c15b930 100644 --- a/content/fetchers/curl.c +++ b/content/fetchers/curl.c @@ -53,12 +53,10 @@ #include "utils/file.h" #include "content/fetch.h" +#include "content/fetchers.h" #include "content/fetchers/curl.h" #include "content/urldb.h" -/* uncomment this to use scheduler based calling -#define FETCHER_CURLL_SCHEDULED 1 -*/ /** SSL certificate info */ struct cert_info { @@ -160,6 +158,16 @@ void fetch_curl_register(void) curl_version_info_data *data; int i; lwc_string *scheme; + const struct fetcher_operation_table fetcher_ops = { + .initialise = fetch_curl_initialise, + .acceptable = fetch_curl_can_fetch, + .setup = fetch_curl_setup, + .start = fetch_curl_start, + .abort = fetch_curl_abort, + .free = fetch_curl_free, + .poll = fetch_curl_poll, + .finalise = fetch_curl_finalise + }; LOG(("curl_version %s", curl_version())); @@ -261,19 +269,7 @@ void fetch_curl_register(void) continue; } - if (!fetch_add_fetcher(scheme, - fetch_curl_initialise, - fetch_curl_can_fetch, - fetch_curl_setup, - fetch_curl_start, - fetch_curl_abort, - fetch_curl_free, -#ifdef FETCHER_CURLL_SCHEDULED - NULL, -#else - fetch_curl_poll, -#endif - fetch_curl_finalise)) { + if (fetcher_add(scheme, &fetcher_ops) != NSERROR_OK) { LOG(("Unable to register cURL fetcher for %s", data->protocols[i])); } @@ -835,12 +831,6 @@ void fetch_curl_poll(lwc_string *scheme_ignored) } curl_msg = curl_multi_info_read(fetch_curl_multi, &queue); } - -#ifdef FETCHER_CURLL_SCHEDULED - if (running != 0) { - guit->browser->schedule(10, fetch_curl_poll, fetch_curl_poll); - } -#endif } -- cgit v1.2.3