diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2014-07-08 19:23:55 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2014-07-08 19:23:55 +0100 |
commit | 3c818abaea53b61c15393d1aeaefd1eba52f4d5c (patch) | |
tree | 13704d81d7041a4cd4bc44414baf0de6045021db /monkey/poll.c | |
parent | e7e914b6242a17abebb84ecfc5f0b1facaac4e94 (diff) | |
parent | 0694f345daa509546d79f31be285987f43cc5be3 (diff) | |
download | netsurf-3c818abaea53b61c15393d1aeaefd1eba52f4d5c.tar.gz netsurf-3c818abaea53b61c15393d1aeaefd1eba52f4d5c.tar.bz2 |
Merge branch 'master' of git://git.netsurf-browser.org/netsurf
Diffstat (limited to 'monkey/poll.c')
-rw-r--r-- | monkey/poll.c | 79 |
1 files changed, 30 insertions, 49 deletions
diff --git a/monkey/poll.c b/monkey/poll.c index 414d458bd..e65f2d3e2 100644 --- a/monkey/poll.c +++ b/monkey/poll.c @@ -22,7 +22,7 @@ #include "desktop/gui.h" #include "monkey/schedule.h" #include "monkey/browser.h" -#include "content/fetchers/curl.h" +#include "content/fetchers.h" #include "monkey/dispatch.h" #include "monkey/poll.h" @@ -90,58 +90,43 @@ monkey_prepare_input(void) void monkey_poll(bool active) { - CURLMcode code; fd_set read_fd_set, write_fd_set, exc_fd_set; int max_fd; GPollFD *fd_list[1000]; unsigned int fd_count = 0; bool block = true; - - schedule_run(); - if (browser_reformat_pending) - block = false; - - if (active) { - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&exc_fd_set); - code = curl_multi_fdset(fetch_curl_multi, - &read_fd_set, - &write_fd_set, - &exc_fd_set, - &max_fd); - assert(code == CURLM_OK); - LOG(("maxfd from curl is %d", max_fd)); - for (int i = 0; i <= max_fd; i++) { - if (FD_ISSET(i, &read_fd_set)) { - GPollFD *fd = malloc(sizeof *fd); - fd->fd = i; - fd->events = G_IO_IN | G_IO_HUP | G_IO_ERR; - g_main_context_add_poll(0, fd, 0); - fd_list[fd_count++] = fd; - LOG(("Want to read %d", i)); - } - if (FD_ISSET(i, &write_fd_set)) { - GPollFD *fd = malloc(sizeof *fd); - fd->fd = i; - fd->events = G_IO_OUT | G_IO_ERR; - g_main_context_add_poll(0, fd, 0); - fd_list[fd_count++] = fd; - LOG(("Want to write %d", i)); - } - if (FD_ISSET(i, &exc_fd_set)) { - GPollFD *fd = malloc(sizeof *fd); - fd->fd = i; - fd->events = G_IO_ERR; - g_main_context_add_poll(0, fd, 0); - fd_list[fd_count++] = fd; - LOG(("Want to check %d", i)); - } + fetcher_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); + fd->fd = i; + fd->events = G_IO_IN | G_IO_HUP | G_IO_ERR; + g_main_context_add_poll(0, fd, 0); + fd_list[fd_count++] = fd; + LOG(("Want to read %d", i)); + } + if (FD_ISSET(i, &write_fd_set)) { + GPollFD *fd = malloc(sizeof *fd); + fd->fd = i; + fd->events = G_IO_OUT | G_IO_ERR; + g_main_context_add_poll(0, fd, 0); + fd_list[fd_count++] = fd; + LOG(("Want to write %d", i)); + } + if (FD_ISSET(i, &exc_fd_set)) { + GPollFD *fd = malloc(sizeof *fd); + fd->fd = i; + fd->events = G_IO_ERR; + g_main_context_add_poll(0, fd, 0); + fd_list[fd_count++] = fd; + LOG(("Want to check %d", i)); } } - - LOG(("Iterate %sactive %sblocking", active?"":"in", block?"":"non-")); + + schedule_run(); + + LOG(("Iterate %sblocking", block?"":"non-")); if (block) { fprintf(stdout, "GENERIC POLL BLOCKING\n"); } @@ -152,9 +137,5 @@ monkey_poll(bool active) free(fd_list[i]); } - schedule_run(); - - if (browser_reformat_pending) - monkey_window_process_reformats(); } |