MHD_start_daemon(): moved daemon flags internal initialisation

This commit is contained in:
Evgeny Grin (Karlson2k)
2023-11-21 17:37:13 +03:00
parent 149db58a06
commit 5cbdf77176
+14 -15
View File
@@ -7594,6 +7594,10 @@ MHD_start_daemon_va (unsigned int flags,
MHD_check_global_init_ ();
eflags = (enum MHD_FLAG) flags;
pflags = &eflags;
if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION))
*pflags |= MHD_USE_INTERNAL_POLLING_THREAD; /* Force enable, log warning later if needed */
#ifndef HAVE_INET6
if (0 != (*pflags & MHD_USE_IPv6))
return NULL;
@@ -7657,6 +7661,16 @@ MHD_start_daemon_va (unsigned int flags,
#endif
}
if (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD))
*pflags = (*pflags & ~((enum MHD_FLAG) MHD_USE_ITC)); /* useless if we are using 'external' select */
else
{
#ifdef HAVE_LISTEN_SHUTDOWN
if (0 != (*pflags & MHD_USE_NO_LISTEN_SOCKET))
#endif
*pflags |= MHD_USE_ITC; /* yes, must use ITC to signal thread */
}
if (NULL == (daemon = MHD_calloc_ (1, sizeof (struct MHD_Daemon))))
return NULL;
interim_params = (struct MHD_InterimParams_ *) \
@@ -7723,21 +7737,6 @@ MHD_start_daemon_va (unsigned int flags,
daemon->fdset_size_set_by_app = false;
#endif /* HAS_FD_SETSIZE_OVERRIDABLE */
if ( (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) &&
(0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) )
{
/* Log warning message later, when log parameters are processes */
*pflags |= MHD_USE_INTERNAL_POLLING_THREAD;
}
if (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD))
*pflags = (*pflags & ~((enum MHD_FLAG) MHD_USE_ITC)); /* useless if we are using 'external' select */
else
{
#ifdef HAVE_LISTEN_SHUTDOWN
if (0 != (*pflags & MHD_USE_NO_LISTEN_SOCKET))
#endif
*pflags |= MHD_USE_ITC; /* yes, must use ITC to signal thread */
}
#ifdef DAUTH_SUPPORT
daemon->digest_auth_rand_size = 0;
daemon->digest_auth_random = NULL;