gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r17098 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r17098 - gnunet/src/transport
Date: Thu, 29 Sep 2011 11:26:23 +0200

Author: wachs
Date: 2011-09-29 11:26:23 +0200 (Thu, 29 Sep 2011)
New Revision: 17098

Modified:
   gnunet/src/transport/plugin_transport_http_server.c
Log:
setting default connection timeout depending on MHD version


Modified: gnunet/src/transport/plugin_transport_http_server.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_server.c 2011-09-28 23:06:28 UTC 
(rev 17097)
+++ gnunet/src/transport/plugin_transport_http_server.c 2011-09-29 09:26:23 UTC 
(rev 17098)
@@ -76,24 +76,6 @@
 }
 
 
-/**
- * Callback called by MHD when it needs data to send
- * @param cls current session
- * @param pos position in buffer
- * @param buf the buffer to write data to
- * @param max max number of bytes available in buffer
- * @return bytes written to buffer
- */
-#if 0
-static ssize_t
-server_send_cb (void *cls, uint64_t pos, char *buf, size_t max)
-{
-
-  return 0;
-}
-#endif
-
-
 #if BUILD_HTTPS
 static char *
 server_load_file (const char *file)
@@ -865,16 +847,29 @@
 server_start (struct Plugin *plugin)
 {
   int res = GNUNET_OK;
+  unsigned int timeout;
 
 #if BUILD_HTTPS
   res = server_load_certificate (plugin);
   if (res == GNUNET_SYSERR)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TABORT\n");
+    GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
+        "Could not load or create server certificate! Loading plugin 
failed!\n");
     return res;
   }
 #endif
 
+
+#if MHD_VERSION >= 0x00090E00
+  timeout = 3;
+  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+      "MHD can set timeout per connection! Default time out %u sec.\n", 
timeout);
+#else
+  timeout = GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value / 1000;
+  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+      "MHD cannot set timeout per connection! Default time out %u sec.\n", 
timeout);
+#endif
+
   plugin->server_v4 = NULL;
   if (plugin->ipv4 == GNUNET_YES)
   {
@@ -903,7 +898,7 @@
                                            plugin->cert,
 #endif
                                            MHD_OPTION_CONNECTION_TIMEOUT,
-                                           (unsigned int) 3,
+                                           timeout ,
                                            MHD_OPTION_CONNECTION_MEMORY_LIMIT,
                                            (size_t) (2 *
                                                      
GNUNET_SERVER_MAX_MESSAGE_SIZE),
@@ -942,7 +937,7 @@
                                            plugin->cert,
 #endif
                                            MHD_OPTION_CONNECTION_TIMEOUT,
-                                           (unsigned int) 3,
+                                           timeout,
                                            MHD_OPTION_CONNECTION_MEMORY_LIMIT,
                                            (size_t) (2 *
                                                      
GNUNET_SERVER_MAX_MESSAGE_SIZE),




reply via email to

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