gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r36290 - in libmicrohttpd: . src/include src/microhttpd src


From: gnunet
Subject: [GNUnet-SVN] r36290 - in libmicrohttpd: . src/include src/microhttpd src/testcurl
Date: Wed, 2 Sep 2015 16:45:28 +0200

Author: grothoff
Date: 2015-09-02 16:45:28 +0200 (Wed, 02 Sep 2015)
New Revision: 36290

Modified:
   libmicrohttpd/AUTHORS
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/include/microhttpd.h
   libmicrohttpd/src/microhttpd/daemon.c
   libmicrohttpd/src/testcurl/test_callback.c
Log:
patch from FC to fix use of resume in combination with external select

Modified: libmicrohttpd/AUTHORS
===================================================================
--- libmicrohttpd/AUTHORS       2015-08-31 17:23:36 UTC (rev 36289)
+++ libmicrohttpd/AUTHORS       2015-09-02 14:45:28 UTC (rev 36290)
@@ -54,6 +54,7 @@
 Robert Groenenberg <address@hidden>
 Denis Dowling <address@hidden>
 Louis Benoit <address@hidden>
+Flavio Coelin <address@hidden>
 
 Documentation contributions also came from:
 Marco Maggi <address@hidden>

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2015-08-31 17:23:36 UTC (rev 36289)
+++ libmicrohttpd/ChangeLog     2015-09-02 14:45:28 UTC (rev 36290)
@@ -1,3 +1,8 @@
+Wed Sep  2 16:50:31 CEST 2015
+       Call resume_suspended_connections() when the user is running
+       its own mainloop and calls MHD_run_from_select() to support
+       resuming connections with external select. -FC
+       
 Sun Aug 30 14:53:51 CEST 2015
        Correct documentation as to when MHD_USE_EPOLL_LINUX_ONLY
        is allowed. -CG

Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h      2015-08-31 17:23:36 UTC (rev 
36289)
+++ libmicrohttpd/src/include/microhttpd.h      2015-09-02 14:45:28 UTC (rev 
36290)
@@ -130,7 +130,7 @@
  * Current version of the library.
  * 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00094210
+#define MHD_VERSION 0x00094211
 
 /**
  * MHD-internal return code for "YES".

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2015-08-31 17:23:36 UTC (rev 
36289)
+++ libmicrohttpd/src/microhttpd/daemon.c       2015-09-02 14:45:28 UTC (rev 
36290)
@@ -2220,6 +2220,12 @@
   char tmp;
   struct MHD_Connection *pos;
   struct MHD_Connection *next;
+  unsigned int mask = MHD_USE_SUSPEND_RESUME | 
MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY |
+    MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL_INTERNALLY | 
MHD_USE_THREAD_PER_CONNECTION;
+ 
+  /* Resuming external connections when using an extern mainloop  */
+  if (MHD_USE_SUSPEND_RESUME == (daemon->options & mask))
+    resume_suspended_connections (daemon);
 
 #if EPOLL_SUPPORT
   if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))

Modified: libmicrohttpd/src/testcurl/test_callback.c
===================================================================
--- libmicrohttpd/src/testcurl/test_callback.c  2015-08-31 17:23:36 UTC (rev 
36289)
+++ libmicrohttpd/src/testcurl/test_callback.c  2015-09-02 14:45:28 UTC (rev 
36290)
@@ -17,31 +17,29 @@
      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
      Boston, MA 02110-1301, USA.
 */
-
 /**
  * @file test_callback.c
  * @brief Testcase for MHD not calling the callback too often
- * @author Jan Seeger 
+ * @author Jan Seeger
  * @author Christian Grothoff
  */
-
-
 #include "MHD_config.h"
 #include "platform.h"
 #include <curl/curl.h>
 #include <microhttpd.h>
 
-struct callback_closure {
+struct callback_closure
+{
   unsigned int called;
 };
 
 
-static ssize_t 
-called_twice(void *cls, uint64_t pos, char *buf, size_t max) 
+static ssize_t
+called_twice(void *cls, uint64_t pos, char *buf, size_t max)
 {
   struct callback_closure *cls2 = cls;
-  
-  if (cls2->called == 0) 
+
+  if (cls2->called == 0)
     {
       memset(buf, 0, max);
       strcat(buf, "test");
@@ -48,12 +46,12 @@
       cls2->called = 1;
       return strlen(buf);
     }
-  if (cls2->called == 1) 
+  if (cls2->called == 1)
     {
       cls2->called = 2;
       return MHD_CONTENT_READER_END_OF_STREAM;
     }
-  fprintf(stderr, 
+  fprintf(stderr,
          "Handler called after returning END_OF_STREAM!\n");
   return MHD_CONTENT_READER_END_WITH_ERROR;
 }
@@ -60,16 +58,22 @@
 
 
 static int
-callback(void *cls, struct MHD_Connection *connection, const char *url,
-        const char *method, const char *version, const char *upload_data,
-        size_t *upload_data_size, void **con_cls) {
+callback(void *cls,
+         struct MHD_Connection *connection,
+         const char *url,
+        const char *method,
+         const char *version,
+         const char *upload_data,
+        size_t *upload_data_size,
+         void **con_cls)
+{
   struct callback_closure *cbc = calloc(1, sizeof(struct callback_closure));
   struct MHD_Response *r;
 
-  r = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 1024, 
-                                        &called_twice, cbc, 
+  r = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 1024,
+                                        &called_twice, cbc,
                                         &free);
-  MHD_queue_response(connection, 200, r);
+  MHD_queue_response(connection, MHD_HTTP_OK, r);
   MHD_destroy_response(r);
   return MHD_YES;
 }
@@ -82,7 +86,8 @@
 }
 
 
-int main(int argc, char **argv) 
+int
+main(int argc, char **argv)
 {
   struct MHD_Daemon *d;
   fd_set rs;
@@ -97,11 +102,11 @@
   struct timeval tv;
   int extra;
 
-  d = MHD_start_daemon(0, 
+  d = MHD_start_daemon(0,
                       8000,
                       NULL,
                       NULL,
-                      callback,
+                      &callback,
                       NULL,
                       MHD_OPTION_END);
   c = curl_easy_init ();
@@ -145,7 +150,7 @@
              curl_easy_cleanup (c);
              MHD_stop_daemon (d);
              return 3;
-           }   
+           }
        }
       if (MHD_YES !=
          MHD_get_fdset(d, &rs, &ws, &es, &max))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]