- MHD_NO_FLAG, plugin->port,
- &server_accept_cb, plugin,
- &server_access_cb, plugin,
- MHD_OPTION_SOCK_ADDR,
- (struct sockaddr_in *)
- plugin->server_addr_v4,
- MHD_OPTION_CONNECTION_LIMIT,
- (unsigned int)
- plugin->max_connections,
+ MHD_USE_SUSPEND_RESUME |
+ v6,
+ plugin->port,
+ &server_accept_cb, plugin,
+ &server_access_cb, plugin,
+ MHD_OPTION_SOCK_ADDR,
+ addr,
+ MHD_OPTION_CONNECTION_LIMIT,
+ (unsigned int) plugin->max_request,
+#if BUILD_HTTPS
+ MHD_OPTION_HTTPS_PRIORITIES,
+ plugin->crypto_init,
+ MHD_OPTION_HTTPS_MEM_KEY,
+ plugin->key,
+ MHD_OPTION_HTTPS_MEM_CERT,
+ plugin->cert,
+#endif
+ MHD_OPTION_CONNECTION_TIMEOUT,
+ timeout,
+ MHD_OPTION_CONNECTION_MEMORY_LIMIT,
+ (size_t) (2 *
+ GNUNET_MAX_MESSAGE_SIZE),
+ MHD_OPTION_NOTIFY_COMPLETED,
+ &server_disconnect_cb, plugin,
+ MHD_OPTION_NOTIFY_CONNECTION,
+ &server_connection_cb, plugin,
+ MHD_OPTION_EXTERNAL_LOGGER,
+ &server_log, NULL,
+ MHD_OPTION_END);
+#ifdef TCP_STEALTH
+ if ( (NULL != server) &&
+ (0 != (plugin->options & HTTP_OPTIONS_TCP_STEALTH)) )
+ {
+ const union MHD_DaemonInfo *di;
+
+ di = MHD_get_daemon_info (server,
+ MHD_DAEMON_INFO_LISTEN_FD,
+ NULL);
+ if ( (0 != setsockopt ((int) di->listen_fd,
+ IPPROTO_TCP,
+ TCP_STEALTH,
+ plugin->env->my_identity,
+ sizeof (struct GNUNET_PeerIdentity))) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("TCP_STEALTH not supported on this platform.\n"));
+ MHD_stop_daemon (server);
+ server = NULL;
+ }
+ }
+#endif
+ return server;
+}
+
+
+/**
+ * Start the HTTP server
+ *
+ * @param plugin the plugin handle
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
+ */
+static int
+server_start (struct HTTP_Server_Plugin *plugin)
+{
+ const char *msg;
+
+ GNUNET_assert (NULL != plugin);