gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r14766 - in libmicrohttpd: . src/daemon src/include src/tes


From: gnunet
Subject: [GNUnet-SVN] r14766 - in libmicrohttpd: . src/daemon src/include src/testcurl
Date: Tue, 29 Mar 2011 14:19:21 +0200

Author: grothoff
Date: 2011-03-29 14:19:21 +0200 (Tue, 29 Mar 2011)
New Revision: 14766

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/daemon/daemon.c
   libmicrohttpd/src/daemon/memorypool.c
   libmicrohttpd/src/include/microhttpd.h
   libmicrohttpd/src/testcurl/daemontest_get.c
Log:
fixes

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2011-03-29 11:53:16 UTC (rev 14765)
+++ libmicrohttpd/ChangeLog     2011-03-29 12:19:21 UTC (rev 14766)
@@ -1,3 +1,7 @@
+Tue Mar 29 14:11:19 CEST 2011
+       Fixed call to mmap for memory pool, extended testcase to cover
+       POLL. -CG
+
 Wed Mar 23 23:24:25 CET 2011
        Do not use POLLIN when we only care about POLLHUP (significantly
        improves performance when using MHD_USE_THREAD_PER_CONNECTION

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2011-03-29 11:53:16 UTC (rev 14765)
+++ libmicrohttpd/src/daemon/daemon.c   2011-03-29 12:19:21 UTC (rev 14766)
@@ -1365,7 +1365,7 @@
     unsigned int poll_server;
     
     memset (p, 0, sizeof (p));
-    if ( (daemon->max_connections == 0) && (daemon->socket_fd != -1) )
+    if ( (daemon->max_connections > 0) && (daemon->socket_fd != -1) )
       {
        poll_server = 1;
        p[0].fd = daemon->socket_fd;

Modified: libmicrohttpd/src/daemon/memorypool.c
===================================================================
--- libmicrohttpd/src/daemon/memorypool.c       2011-03-29 11:53:16 UTC (rev 
14765)
+++ libmicrohttpd/src/daemon/memorypool.c       2011-03-29 12:19:21 UTC (rev 
14766)
@@ -86,7 +86,7 @@
     return NULL;
 #ifdef MAP_ANONYMOUS
   pool->memory = MMAP (NULL, max, PROT_READ | PROT_WRITE,
-                       MAP_ANONYMOUS, -1, 0);
+                       MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 #else
   pool->memory = MAP_FAILED;
 #endif

Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h      2011-03-29 11:53:16 UTC (rev 
14765)
+++ libmicrohttpd/src/include/microhttpd.h      2011-03-29 12:19:21 UTC (rev 
14766)
@@ -362,8 +362,6 @@
 
   /**
    * Use poll instead of select. This allows sockets with fd >= FD_SETSIZE.
-   * This option only works in conjunction with MHD_USE_THREAD_PER_CONNECTION
-   * (at this point).
    */
   MHD_USE_POLL = 64
 };
@@ -1230,7 +1228,6 @@
                                                         crfc);
 
 
-
 /**
  * Create a response object.  The response object can be extended with
  * header information and then be used any number of times.

Modified: libmicrohttpd/src/testcurl/daemontest_get.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_get.c 2011-03-29 11:53:16 UTC (rev 
14765)
+++ libmicrohttpd/src/testcurl/daemontest_get.c 2011-03-29 12:19:21 UTC (rev 
14766)
@@ -1,6 +1,6 @@
 /*
      This file is part of libmicrohttpd
-     (C) 2007, 2009 Christian Grothoff
+     (C) 2007, 2009, 2011 Christian Grothoff
 
      libmicrohttpd is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -97,7 +97,7 @@
 
 
 static int
-testInternalGet ()
+testInternalGet (int poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -108,7 +108,7 @@
   cbc.buf = buf;
   cbc.size = 2048;
   cbc.pos = 0;
-  d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
+  d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG  | poll_flag,
                         11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
   if (d == NULL)
     return 1;
@@ -146,7 +146,7 @@
 }
 
 static int
-testMultithreadedGet ()
+testMultithreadedGet (int poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -157,7 +157,7 @@
   cbc.buf = buf;
   cbc.size = 2048;
   cbc.pos = 0;
-  d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
+  d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG  | 
poll_flag,
                         1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
   if (d == NULL)
     return 16;
@@ -195,7 +195,7 @@
 }
 
 static int
-testMultithreadedPoolGet ()
+testMultithreadedPoolGet (int poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -206,7 +206,7 @@
   cbc.buf = buf;
   cbc.size = 2048;
   cbc.pos = 0;
-  d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
+  d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag,
                         1081, NULL, NULL, &ahc_echo, "GET",
                         MHD_OPTION_THREAD_POOL_SIZE, 4, MHD_OPTION_END);
   if (d == NULL)
@@ -367,7 +367,7 @@
 }
 
 static int
-testUnknownPortGet ()
+testUnknownPortGet (int poll_flag)
 {
   struct MHD_Daemon *d;
   const union MHD_DaemonInfo *di;
@@ -386,7 +386,7 @@
   cbc.buf = buf;
   cbc.size = 2048;
   cbc.pos = 0;
-  d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
+  d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG  | poll_flag,
                         1, NULL, NULL, &ahc_echo, "GET",
                         MHD_OPTION_SOCK_ADDR, &addr,
                         MHD_OPTION_END);
@@ -441,13 +441,13 @@
 
 
 static int
-testStopRace ()
+testStopRace (int poll_flag)
 {
     struct sockaddr_in sin;
     int fd;
     struct MHD_Daemon *d;
     
-    d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
+    d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | 
poll_flag,
                          1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
     if (d == NULL)
        return 16;
@@ -493,12 +493,17 @@
   oneone = NULL != strstr (argv[0], "11");
   if (0 != curl_global_init (CURL_GLOBAL_WIN32))
     return 2;
-  errorCount += testInternalGet ();
-  errorCount += testMultithreadedGet ();
-  errorCount += testMultithreadedPoolGet ();
+  errorCount += testInternalGet (0);
+  errorCount += testMultithreadedGet (0);
+  errorCount += testMultithreadedPoolGet (0);
+  errorCount += testUnknownPortGet (0);
+  errorCount += testStopRace (0);
   errorCount += testExternalGet ();
-  errorCount += testUnknownPortGet ();
-  errorCount += testStopRace ();
+  errorCount += testInternalGet (MHD_USE_POLL);
+  errorCount += testMultithreadedGet (MHD_USE_POLL);
+  errorCount += testMultithreadedPoolGet (MHD_USE_POLL);
+  errorCount += testUnknownPortGet (MHD_USE_POLL);
+  errorCount += testStopRace (MHD_USE_POLL);
   if (errorCount != 0)
     fprintf (stderr, "Error (code: %u)\n", errorCount);
   curl_global_cleanup ();




reply via email to

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