aboutsummaryrefslogtreecommitdiff
path: root/src/examples/demo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/demo.c')
-rw-r--r--src/examples/demo.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/examples/demo.c b/src/examples/demo.c
index 3f953a8f..281d594e 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -43,7 +43,7 @@
43 * Number of threads to run in the thread pool. Should (roughly) match 43 * Number of threads to run in the thread pool. Should (roughly) match
44 * the number of cores on your system. 44 * the number of cores on your system.
45 */ 45 */
46#define NUMBER_OF_THREADS 8 46#define NUMBER_OF_THREADS 4
47 47
48/** 48/**
49 * How many bytes of a file do we give to libmagic to determine the mime type? 49 * How many bytes of a file do we give to libmagic to determine the mime type?
@@ -362,6 +362,9 @@ update_directory ()
362 rdc.buf, 362 rdc.buf,
363 MHD_RESPMEM_MUST_FREE); 363 MHD_RESPMEM_MUST_FREE);
364 mark_as_html (response); 364 mark_as_html (response);
365 (void) MHD_add_response_header (response,
366 MHD_HTTP_HEADER_CONNECTION,
367 "close");
365 update_cached_response (response); 368 update_cached_response (response);
366} 369}
367 370
@@ -859,12 +862,18 @@ main (int argc, char *const *argv)
859 MHD_RESPMEM_PERSISTENT); 862 MHD_RESPMEM_PERSISTENT);
860 mark_as_html (internal_error_response); 863 mark_as_html (internal_error_response);
861 update_directory (); 864 update_directory ();
862 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, 865 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG
866#if EPOLL_SUPPORT
867 | MHD_USE_EPOLL_LINUX_ONLY
868#endif
869 ,
863 port, 870 port,
864 NULL, NULL, 871 NULL, NULL,
865 &generate_page, NULL, 872 &generate_page, NULL,
866 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (256 * 1024), 873 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (256 * 1024),
874#if PRODUCTION
867 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) (64), 875 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) (64),
876#endif
868 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) (120 /* seconds */), 877 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) (120 /* seconds */),
869 MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) NUMBER_OF_THREADS, 878 MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) NUMBER_OF_THREADS,
870 MHD_OPTION_NOTIFY_COMPLETED, &response_completed_callback, NULL, 879 MHD_OPTION_NOTIFY_COMPLETED, &response_completed_callback, NULL,