diff -u -r libmicrohttpd-0.9.72-orig/src/microhttpd/daemon.c libmicrohttpd-0.9.72/src/microhttpd/daemon.c
--- libmicrohttpd-0.9.72-orig/src/microhttpd/daemon.c	2020-12-28 12:17:34.000000000 +0000
+++ libmicrohttpd-0.9.72/src/microhttpd/daemon.c	2021-01-08 15:29:04.310642072 +0000
@@ -2356,6 +2356,56 @@
 #endif /* HTTPS_SUPPORT */


+static int
+internal_queue_connection (struct MHD_Daemon *daemon,
+                           MHD_socket sock,
+                           const struct sockaddr *addr,
+                           socklen_t alen,
+                           bool sk_nonbl)
+{
+  struct MHD_QueuedConn *qc;
+
+  if(!(qc = (struct MHD_QueuedConn *)malloc(sizeof(struct MHD_QueuedConn))))
+    return MHD_NO;
+
+  if(!(qc->addr = (struct sockaddr *)malloc(alen)))
+  {
+    free(qc);
+    return MHD_NO;
+  }
+
+  qc->sock = sock;
+  qc->addr_len = alen;
+  qc->sk_nonbl = sk_nonbl;
+  qc->next = NULL;
+  memcpy(qc->addr, addr, alen);
+
+  MHD_mutex_lock_chk_ (&daemon->qconn_mutex);
+  if(!daemon->qconn_tail)
+  {
+    daemon->qconn_head = qc;
+    daemon->qconn_tail = qc;
+  }
+  else
+  {
+    daemon->qconn_tail->next = qc;
+    daemon->qconn_tail = qc;
+  }
+  MHD_mutex_unlock_chk_(&daemon->qconn_mutex);
+
+  if ( (MHD_ITC_IS_VALID_(daemon->itc)) &&
+       (! MHD_itc_activate_ (daemon->itc, "c")) )
+  {
+#ifdef HAVE_MESSAGES
+    MHD_DLOG (daemon,
+              _("Failed to signal queued connection via inter-thread communication channel."));
+#endif
+  }
+
+  return MHD_YES;
+}
+
+
 /**
  * Do basic preparation work on the new incoming connection.
  *
@@ -3435,6 +3485,16 @@
   }
 #endif /* MHD_USE_POSIX_THREADS || MHD_USE_W32_THREADS */

+  if ( (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD) ) &&
+       (0 != (daemon->options & MHD_USE_EPOLL) ) )
+  {
+    return internal_queue_connection (daemon,
+                                      client_socket,
+                                      addr,
+                                      addrlen,
+                                      sk_nonbl);
+  }
+
   return internal_add_connection (daemon,
                                   client_socket,
                                   addr,
@@ -4707,6 +4767,8 @@
   int num_events;
   unsigned int i;
   MHD_socket ls;
+  struct MHD_QueuedConn *qc;
+  struct MHD_QueuedConn *pqc;
 #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
   bool run_upgraded = false;
 #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
@@ -4992,6 +5054,32 @@
     }
   }

+  MHD_mutex_lock_chk_ (&daemon->qconn_mutex);
+  qc = daemon->qconn_head;
+  while(NULL != qc)
+  {
+    if (internal_add_connection(daemon,
+                                qc->sock,
+                                qc->addr,
+                                qc->addr_len,
+                                false,
+                                qc->sk_nonbl,
+                                false) == MHD_NO)
+    {
+#ifdef HAVE_MESSAGES
+      MHD_DLOG (daemon, _("Failed to add queued connection\n"));
+#endif
+      MHD_socket_close_chk_ (qc->sock);
+    }
+
+    free (qc->addr);
+    pqc = qc;
+    qc = qc->next;
+    free (pqc);
+  }
+
+  daemon->qconn_head = daemon->qconn_tail = NULL;
+  MHD_mutex_unlock_chk_ (&daemon->qconn_mutex);
   return MHD_YES;
 }

@@ -6009,14 +6097,13 @@
       return MHD_NO;
   }
 #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
-  if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) &&
-       (! daemon->was_quiesced) )
+  if (MHD_ITC_IS_VALID_ (daemon->itc))
   {
     event.events = EPOLLIN;
-    event.data.ptr = daemon;
+    event.data.ptr = (void *) epoll_itc_marker;
     if (0 != epoll_ctl (daemon->epoll_fd,
                         EPOLL_CTL_ADD,
-                        ls,
+                        MHD_itc_r_fd_ (daemon->itc),
                         &event))
     {
 #ifdef HAVE_MESSAGES
@@ -6026,16 +6113,16 @@
 #endif
       return MHD_NO;
     }
-    daemon->listen_socket_in_epoll = true;
   }

-  if (MHD_ITC_IS_VALID_ (daemon->itc))
+  if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) &&
+       (! daemon->was_quiesced) )
   {
     event.events = EPOLLIN;
-    event.data.ptr = (void *) epoll_itc_marker;
+    event.data.ptr = daemon;
     if (0 != epoll_ctl (daemon->epoll_fd,
                         EPOLL_CTL_ADD,
-                        MHD_itc_r_fd_ (daemon->itc),
+                        ls,
                         &event))
     {
 #ifdef HAVE_MESSAGES
@@ -6045,7 +6132,9 @@
 #endif
       return MHD_NO;
     }
+    daemon->listen_socket_in_epoll = true;
   }
+
   return MHD_YES;
 }

@@ -6230,6 +6319,9 @@
   daemon->sigpipe_blocked = true;
 #endif /* _WIN32 && ! __CYGWIN__ */

+  daemon->qconn_head = NULL;
+  daemon->qconn_tail = NULL;
+
   if ( (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) &&
        (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) )
   {
@@ -7023,6 +7115,17 @@
   daemon->https_key_password = NULL;
 #endif /* HTTPS_SUPPORT */

+#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
+  if (! MHD_mutex_init_ (&daemon->qconn_mutex))
+  {
+#ifdef HAVE_MESSAGES
+    MHD_DLOG (daemon,
+              _("Failed to initialize queued connection mutex\n"));
+#endif
+    goto thread_failed;
+  }
+#endif
+
   return daemon;

 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
diff -u -r libmicrohttpd-0.9.72-orig/src/microhttpd/internal.h libmicrohttpd-0.9.72/src/microhttpd/internal.h
--- libmicrohttpd-0.9.72-orig/src/microhttpd/internal.h	2020-12-28 12:17:34.000000000 +0000
+++ libmicrohttpd-0.9.72/src/microhttpd/internal.h	2021-01-08 15:29:04.310642072 +0000
@@ -1301,6 +1313,15 @@
                     char *uri);


+struct MHD_QueuedConn {
+  MHD_socket sock;
+  struct sockaddr *addr;
+  socklen_t addr_len;
+  bool sk_nonbl;
+  struct MHD_QueuedConn *next;
+};
+
+
 /**
  * State kept for each MHD daemon.  All connections are kept in two
  * doubly-linked lists.  The first one reflects the state of the
@@ -1850,6 +1871,11 @@
    * The size of queue for listen socket.
    */
   unsigned int listen_backlog_size;
+
+  struct MHD_QueuedConn *qconn_head;
+  struct MHD_QueuedConn *qconn_tail;
+
+  MHD_mutex_ qconn_mutex;
 };
