diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2016-06-27 21:00:58 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2016-06-27 21:00:58 +0100 |
commit | a468b409901236ecf77f0cbd81dfeda96cebc758 (patch) | |
tree | 9796fda726d37a3a30da44fbcb8690d200b2b079 /content/fetch.c | |
parent | ab6c03f3112ef01e41a8a1e931a6990636edbae4 (diff) | |
download | netsurf-a468b409901236ecf77f0cbd81dfeda96cebc758.tar.gz netsurf-a468b409901236ecf77f0cbd81dfeda96cebc758.tar.bz2 |
Refactor the fdset acquisition into the fetchers to stop fetch.c including curl.h
Diffstat (limited to 'content/fetch.c')
-rw-r--r-- | content/fetch.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/content/fetch.c b/content/fetch.c index c5928ba85..decb261a7 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -39,7 +39,6 @@ #include <strings.h> #include <time.h> #include <libwapcaplet/libwapcaplet.h> -#include <curl/curl.h> #include "utils/config.h" #include "utils/corestrings.h" @@ -386,8 +385,7 @@ nserror fetcher_fdset(fd_set *read_fd_set, fd_set *except_fd_set, int *maxfd_out) { - CURLMcode code; - int maxfd; + int maxfd = -1; int fetcherd; /* fetcher index */ if (!fetch_dispatch_jobs()) { @@ -408,12 +406,19 @@ nserror fetcher_fdset(fd_set *read_fd_set, FD_ZERO(read_fd_set); FD_ZERO(write_fd_set); FD_ZERO(except_fd_set); - code = curl_multi_fdset(fetch_curl_multi, - read_fd_set, - write_fd_set, - except_fd_set, - &maxfd); - assert(code == CURLM_OK); + + for (fetcherd = 0; fetcherd < MAX_FETCHERS; fetcherd++) { + if ((fetchers[fetcherd].refcount > 0) && + (fetchers[fetcherd].ops.fdset != NULL)) { + /* fetcher present */ + int fetcher_maxfd; + fetcher_maxfd = fetchers[fetcherd].ops.fdset( + fetchers[fetcherd].scheme, read_fd_set, + write_fd_set, except_fd_set); + if (fetcher_maxfd > maxfd) + maxfd = fetcher_maxfd; + } + } if (maxfd >= 0) { /* change the scheduled poll to happen is a 1000ms as |