diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-03-26 13:20:19 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-03-26 13:45:05 +0300 |
commit | 7b0d92902c92782844e84e40ab54d58a65531a65 (patch) | |
tree | 1330170cfff18820a8234657ece224f2257cb880 | |
parent | c14c7bb6f17f36582238d3173093cf6ba2bf0caa (diff) | |
download | libmicrohttpd-7b0d92902c92782844e84e40ab54d58a65531a65.tar.gz libmicrohttpd-7b0d92902c92782844e84e40ab54d58a65531a65.zip |
MHD_start_daemon(): removed initialisation of ITC for master daemon in thread pool mode
as global ITC is not monitored.
Fixed gnutls priorities deinitialization if ITC failed
-rw-r--r-- | src/microhttpd/daemon.c | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 41f8e4ec..41b15584 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -5398,6 +5398,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5398 | #endif | 5398 | #endif |
5399 | /* try to open listen socket */ | 5399 | /* try to open listen socket */ |
5400 | #ifdef HTTPS_SUPPORT | 5400 | #ifdef HTTPS_SUPPORT |
5401 | daemon->priority_cache = NULL; | ||
5401 | if (0 != (*pflags & MHD_USE_TLS)) | 5402 | if (0 != (*pflags & MHD_USE_TLS)) |
5402 | { | 5403 | { |
5403 | gnutls_priority_init (&daemon->priority_cache, | 5404 | gnutls_priority_init (&daemon->priority_cache, |
@@ -5450,31 +5451,6 @@ MHD_start_daemon_va (unsigned int flags, | |||
5450 | #endif | 5451 | #endif |
5451 | *pflags |= MHD_USE_ITC; /* yes, must use ITC to signal thread */ | 5452 | *pflags |= MHD_USE_ITC; /* yes, must use ITC to signal thread */ |
5452 | } | 5453 | } |
5453 | if (0 != (*pflags & MHD_USE_ITC)) | ||
5454 | { | ||
5455 | if (! MHD_itc_init_ (daemon->itc)) | ||
5456 | { | ||
5457 | #ifdef HAVE_MESSAGES | ||
5458 | MHD_DLOG (daemon, | ||
5459 | _("Failed to create inter-thread communication channel: %s\n"), | ||
5460 | MHD_itc_last_strerror_ ()); | ||
5461 | #endif | ||
5462 | free (daemon); | ||
5463 | return NULL; | ||
5464 | } | ||
5465 | if ( (0 == (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL))) && | ||
5466 | (! MHD_SCKT_FD_FITS_FDSET_(MHD_itc_r_fd_ (daemon->itc), | ||
5467 | NULL)) ) | ||
5468 | { | ||
5469 | #ifdef HAVE_MESSAGES | ||
5470 | MHD_DLOG (daemon, | ||
5471 | _("file descriptor for inter-thread communication channel exceeds maximum value\n")); | ||
5472 | #endif | ||
5473 | MHD_itc_destroy_chk_ (daemon->itc); | ||
5474 | free (daemon); | ||
5475 | return NULL; | ||
5476 | } | ||
5477 | } | ||
5478 | #ifdef DAUTH_SUPPORT | 5454 | #ifdef DAUTH_SUPPORT |
5479 | daemon->digest_auth_rand_size = 0; | 5455 | daemon->digest_auth_rand_size = 0; |
5480 | daemon->digest_auth_random = NULL; | 5456 | daemon->digest_auth_random = NULL; |
@@ -5500,6 +5476,37 @@ MHD_start_daemon_va (unsigned int flags, | |||
5500 | free (daemon); | 5476 | free (daemon); |
5501 | return NULL; | 5477 | return NULL; |
5502 | } | 5478 | } |
5479 | if ( (0 != (*pflags & MHD_USE_ITC)) && | ||
5480 | (0 == daemon->worker_pool_size) ) | ||
5481 | { | ||
5482 | if (! MHD_itc_init_ (daemon->itc)) | ||
5483 | { | ||
5484 | #ifdef HAVE_MESSAGES | ||
5485 | MHD_DLOG (daemon, | ||
5486 | _("Failed to create inter-thread communication channel: %s\n"), | ||
5487 | MHD_itc_last_strerror_ ()); | ||
5488 | #endif | ||
5489 | if (NULL != daemon->priority_cache) | ||
5490 | gnutls_priority_deinit (daemon->priority_cache); | ||
5491 | free (daemon); | ||
5492 | return NULL; | ||
5493 | } | ||
5494 | if ( (0 == (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL))) && | ||
5495 | (! MHD_SCKT_FD_FITS_FDSET_(MHD_itc_r_fd_ (daemon->itc), | ||
5496 | NULL)) ) | ||
5497 | { | ||
5498 | #ifdef HAVE_MESSAGES | ||
5499 | MHD_DLOG (daemon, | ||
5500 | _("file descriptor for inter-thread communication channel exceeds maximum value\n")); | ||
5501 | #endif | ||
5502 | MHD_itc_destroy_chk_ (daemon->itc); | ||
5503 | if (NULL != daemon->priority_cache) | ||
5504 | gnutls_priority_deinit (daemon->priority_cache); | ||
5505 | free (daemon); | ||
5506 | return NULL; | ||
5507 | } | ||
5508 | } | ||
5509 | |||
5503 | #ifdef DAUTH_SUPPORT | 5510 | #ifdef DAUTH_SUPPORT |
5504 | if (daemon->nonce_nc_size > 0) | 5511 | if (daemon->nonce_nc_size > 0) |
5505 | { | 5512 | { |