aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index fde43df7..10072078 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2457,24 +2457,6 @@ new_connection_prepare_ (struct MHD_Daemon *daemon,
2457 return MHD_NO; 2457 return MHD_NO;
2458 } 2458 }
2459 connection->sk_cork_on = true; /* default is usually ON */ 2459 connection->sk_cork_on = true; /* default is usually ON */
2460 connection->pool = MHD_pool_create (daemon->pool_size);
2461 if (NULL == connection->pool)
2462 {
2463#ifdef HAVE_MESSAGES
2464 MHD_DLOG (daemon,
2465 _ ("Error allocating memory: %s\n"),
2466 MHD_strerror_ (errno));
2467#endif
2468 MHD_socket_close_chk_ (client_socket);
2469 MHD_ip_limit_del (daemon,
2470 addr,
2471 addrlen);
2472 free (connection);
2473#if ENOMEM
2474 errno = ENOMEM;
2475#endif
2476 return MHD_NO;
2477 }
2478 2460
2479 connection->connection_timeout = daemon->connection_timeout; 2461 connection->connection_timeout = daemon->connection_timeout;
2480 if (NULL == (connection->addr = malloc (addrlen))) 2462 if (NULL == (connection->addr = malloc (addrlen)))
@@ -2489,7 +2471,6 @@ new_connection_prepare_ (struct MHD_Daemon *daemon,
2489 MHD_ip_limit_del (daemon, 2471 MHD_ip_limit_del (daemon,
2490 addr, 2472 addr,
2491 addrlen); 2473 addrlen);
2492 MHD_pool_destroy (connection->pool);
2493 free (connection); 2474 free (connection);
2494 errno = eno; 2475 errno = eno;
2495 return MHD_NO; 2476 return MHD_NO;
@@ -2654,6 +2635,29 @@ new_connection_insert_ (struct MHD_Daemon *daemon,
2654{ 2635{
2655 int eno = 0; 2636 int eno = 0;
2656 2637
2638 /* Allocate memory pool in the processing thread so
2639 * intensively used memory area is allocated in "good"
2640 * (for the thread) memory region. It is important with
2641 * NUMA and/or complex cache hierarchy. */
2642 connection->pool = MHD_pool_create (daemon->pool_size);
2643 if (NULL == connection->pool)
2644 {
2645#ifdef HAVE_MESSAGES
2646 MHD_DLOG (daemon,
2647 _ ("Error allocating memory: %s\n"),
2648 MHD_strerror_ (errno));
2649#endif
2650 MHD_socket_close_chk_ (client_socket);
2651 MHD_ip_limit_del (daemon,
2652 addr,
2653 addrlen);
2654 free (connection);
2655#if ENOMEM
2656 errno = ENOMEM;
2657#endif
2658 return MHD_NO;
2659 }
2660
2657#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 2661#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
2658 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); 2662 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
2659#endif 2663#endif