Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/a468b409901236ecf77f0cbd81dfeda96cebc758
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/a468b409901236ecf77f0cbd81dfeda96cebc758
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/a468b409901236ecf77f0cbd81dfeda96cebc758

The branch, master has been updated
       via  a468b409901236ecf77f0cbd81dfeda96cebc758 (commit)
      from  ab6c03f3112ef01e41a8a1e931a6990636edbae4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=a468b409901236ecf77f0cbd81dfeda96cebc758
commit a468b409901236ecf77f0cbd81dfeda96cebc758
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>

    Refactor the fdset acquisition into the fetchers to stop fetch.c including 
curl.h

diff --git a/content/fetch.c b/content/fetch.c
index c5928ba..decb261 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
diff --git a/content/fetchers.h b/content/fetchers.h
index 92b11dc..cd09e92 100644
--- a/content/fetchers.h
+++ b/content/fetchers.h
@@ -91,6 +91,12 @@ struct fetcher_operation_table {
        void (*poll)(lwc_string *scheme);
 
        /**
+        * update an fdset with the FDs needed to poll cleanly
+        */
+       int (*fdset)(lwc_string *scheme, fd_set *read_set, fd_set *write_set,
+                    fd_set *error_set);
+
+       /**
         * Finalise the fetcher.
         */
        void (*finalise)(lwc_string *scheme);
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 10a0d99..66970ef 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -1374,6 +1374,23 @@ fetch_curl_header(char *data, size_t size, size_t nmemb, 
void *_f)
 #undef SKIP_ST
 }
 
+static int fetch_curl_fdset(lwc_string *scheme, fd_set *read_set,
+                           fd_set *write_set, fd_set *error_set)
+{
+       CURLMcode code;
+       int maxfd = -1;
+
+       code = curl_multi_fdset(fetch_curl_multi,
+                               read_set,
+                               write_set,
+                               error_set,
+                               &maxfd);
+       assert(code == CURLM_OK);
+
+       return maxfd;
+}
+
+
 
 /* exported function documented in content/fetchers/curl.h */
 nserror fetch_curl_register(void)
@@ -1390,6 +1407,7 @@ nserror fetch_curl_register(void)
                .abort = fetch_curl_abort,
                .free = fetch_curl_free,
                .poll = fetch_curl_poll,
+               .fdset = fetch_curl_fdset,
                .finalise = fetch_curl_finalise
        };
 


-----------------------------------------------------------------------

Summary of changes:
 content/fetch.c         |   23 ++++++++++++++---------
 content/fetchers.h      |    6 ++++++
 content/fetchers/curl.c |   18 ++++++++++++++++++
 3 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/content/fetch.c b/content/fetch.c
index c5928ba..decb261 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
diff --git a/content/fetchers.h b/content/fetchers.h
index 92b11dc..cd09e92 100644
--- a/content/fetchers.h
+++ b/content/fetchers.h
@@ -91,6 +91,12 @@ struct fetcher_operation_table {
        void (*poll)(lwc_string *scheme);
 
        /**
+        * update an fdset with the FDs needed to poll cleanly
+        */
+       int (*fdset)(lwc_string *scheme, fd_set *read_set, fd_set *write_set,
+                    fd_set *error_set);
+
+       /**
         * Finalise the fetcher.
         */
        void (*finalise)(lwc_string *scheme);
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 10a0d99..66970ef 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -1374,6 +1374,23 @@ fetch_curl_header(char *data, size_t size, size_t nmemb, 
void *_f)
 #undef SKIP_ST
 }
 
+static int fetch_curl_fdset(lwc_string *scheme, fd_set *read_set,
+                           fd_set *write_set, fd_set *error_set)
+{
+       CURLMcode code;
+       int maxfd = -1;
+
+       code = curl_multi_fdset(fetch_curl_multi,
+                               read_set,
+                               write_set,
+                               error_set,
+                               &maxfd);
+       assert(code == CURLM_OK);
+
+       return maxfd;
+}
+
+
 
 /* exported function documented in content/fetchers/curl.h */
 nserror fetch_curl_register(void)
@@ -1390,6 +1407,7 @@ nserror fetch_curl_register(void)
                .abort = fetch_curl_abort,
                .free = fetch_curl_free,
                .poll = fetch_curl_poll,
+               .fdset = fetch_curl_fdset,
                .finalise = fetch_curl_finalise
        };
 


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to