From 47ccd9855db44881339e68093655247a78fd8598 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Mon, 27 Jun 2016 21:09:39 +0100 Subject: Move fetcher_fdset to fetch.h (and rename to fetch_fdset). Maybe not ideal but better --- content/fetch.c | 5 +++-- content/fetch.h | 25 +++++++++++++++++++++++++ content/fetchers.h | 26 -------------------------- frontends/amiga/gui.c | 4 ++-- frontends/beos/gui.cpp | 4 ++-- frontends/gtk/gui.c | 4 ++-- frontends/monkey/main.c | 4 ++-- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/content/fetch.c b/content/fetch.c index decb261a7..11adf9cf4 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -379,8 +379,9 @@ fetcher_add(lwc_string *scheme, const struct fetcher_operation_table *ops) return NSERROR_OK; } -/* exported interface documented in content/fetchers.h */ -nserror fetcher_fdset(fd_set *read_fd_set, +/* exported interface documented in content/fetch.h */ +nserror +fetch_fdset(fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set, int *maxfd_out) diff --git a/content/fetch.h b/content/fetch.h index 3c1f1ccae..6694ffda9 100644 --- a/content/fetch.h +++ b/content/fetch.h @@ -210,5 +210,30 @@ const char *fetch_get_referer_to_send(struct fetch *fetch); */ void fetch_set_cookie(struct fetch *fetch, const char *data); +/** + * Get the set of file descriptors the fetchers are currently using. + * + * This obtains the file descriptors the fetch system is using to + * obtain data. It will cause the fetchers to make progress, if + * possible, potentially completing fetches before requiring activity + * on file descriptors. + * + * If a set of descriptors is returned (maxfd is not -1) The caller is + * expected to wait on them (with select etc.) and continue to obtain + * the fdset with this call. This will switch the fetchers from polled + * mode to waiting for network activity which is much more efficient. + * + * \note If the caller does not subsequently obtain the fdset again + * the fetchers will fall back to the less efficient polled + * operation. The fallback to polled operation will only occour after + * a timeout which introduces additional delay. + * + * \param[out] read_fd_set The fd set for read. + * \param[out] write_fd_set The fd set for write. + * \param[out] except_fd_set The fd set for exceptions. + * \param[out] maxfd The highest fd number in the set or -1 if no fd available. + * \return NSERROR_OK on success or appropriate error code. + */ +nserror fetch_fdset(fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set, int *maxfd); #endif diff --git a/content/fetchers.h b/content/fetchers.h index cd09e92e4..6392e245e 100644 --- a/content/fetchers.h +++ b/content/fetchers.h @@ -129,30 +129,4 @@ nserror fetcher_init(void); void fetcher_quit(void); -/** - * Get the set of file descriptors the fetchers are currently using. - * - * This obtains the file descriptors the fetch system is using to - * obtain data. It will cause the fetchers to make progress, if - * possible, potentially completing fetches before requiring activity - * on file descriptors. - * - * If a set of descriptors is returned (maxfd is not -1) The caller is - * expected to wait on them (with select etc.) and continue to obtain - * the fdset with this call. This will switch the fetchers from polled - * mode to waiting for network activity which is much more efficient. - * - * \note If the caller does not subsequently obtain the fdset again - * the fetchers will fall back to the less efficient polled - * operation. The fallback to polled operation will only occour after - * a timeout which introduces additional delay. - * - * \param[out] read_fd_set The fd set for read. - * \param[out] write_fd_set The fd set for write. - * \param[out] except_fd_set The fd set for exceptions. - * \param[out] maxfd The highest fd number in the set or -1 if no fd available. - * \return NSERROR_OK on success or appropriate error code. - */ -nserror fetcher_fdset(fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set, int *maxfd); - #endif diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index 8d7c69ddb..ba7f979ef 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -108,7 +108,7 @@ #include "netsurf/cookie_db.h" #include "netsurf/url_db.h" #include "content/backing_store.h" -#include "content/fetchers.h" +#include "content/fetch.h" #include "desktop/browser_history.h" #include "desktop/hotlist.h" #include "desktop/version.h" @@ -2788,7 +2788,7 @@ void ami_get_msg(void) uint32 signalmask = winsignal | appsig | schedulesig | rxsig | printsig | applibsig | helpsignal; - if ((fetcher_fdset(&read_fd_set, &write_fd_set, &except_fd_set, &max_fd) == NSERROR_OK) && + if ((fetch_fdset(&read_fd_set, &write_fd_set, &except_fd_set, &max_fd) == NSERROR_OK) && (max_fd != -1)) { /* max_fd is the highest fd in use, but waitselect() needs to know how many * are in use, so we add 1. */ diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp index 0dcbd6b6e..93b304a5c 100644 --- a/frontends/beos/gui.cpp +++ b/frontends/beos/gui.cpp @@ -64,7 +64,7 @@ extern "C" { #include "netsurf/browser_window.h" #include "netsurf/cookie_db.h" #include "netsurf/url_db.h" -#include "content/fetchers.h" +#include "content/fetch.h" } @@ -739,7 +739,7 @@ void nsbeos_gui_poll(void) bigtime_t next_schedule = 0; /* get any active fetcher fd */ - fetcher_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd); + fetch_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd); /* run the scheduler */ schedule_run(); diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c index 16d919967..d358b43db 100644 --- a/frontends/gtk/gui.c +++ b/frontends/gtk/gui.c @@ -38,7 +38,7 @@ #include "utils/utils.h" #include "utils/file.h" #include "utils/nsoption.h" -#include "content/fetchers.h" +#include "content/fetch.h" #include "netsurf/url_db.h" #include "netsurf/cookie_db.h" #include "content/backing_store.h" @@ -401,7 +401,7 @@ static void nsgtk_main(void) FD_ZERO(&write_fd_set); FD_ZERO(&exc_fd_set); - fetcher_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd); + fetch_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd); for (int i = 0; i <= max_fd; i++) { if (FD_ISSET(i, &read_fd_set)) { GPollFD *fd = malloc(sizeof *fd); diff --git a/frontends/monkey/main.c b/frontends/monkey/main.c index 0ddfd9a80..0059ff047 100644 --- a/frontends/monkey/main.c +++ b/frontends/monkey/main.c @@ -35,7 +35,7 @@ #include "netsurf/netsurf.h" #include "netsurf/url_db.h" #include "netsurf/cookie_db.h" -#include "content/fetchers.h" +#include "content/fetch.h" #include "monkey/dispatch.h" #include "monkey/browser.h" @@ -258,7 +258,7 @@ static void monkey_run(void) while (!monkey_done) { /* clears fdset */ - fetcher_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd); + fetch_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd); /* add stdin to the set */ if (max_fd < 0) { -- cgit v1.2.3