aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/response.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/response.c')
-rw-r--r--src/microhttpd/response.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index a97df80c..af30c2eb 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -627,19 +627,16 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
627 /* Application is done with this connection, tear it down! */ 627 /* Application is done with this connection, tear it down! */
628 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION) ) 628 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION) )
629 { 629 {
630 if (0 == (daemon->options & MHD_USE_SSL) )
631 {
632 /* just need to signal the thread that we are done */
633 MHD_semaphore_up (connection->upgrade_sem);
634 }
635#if HTTPS_SUPPORT 630#if HTTPS_SUPPORT
636 else 631 if (0 != (daemon->options & MHD_USE_SSL) )
637 { 632 {
638 /* signal thread by shutdown() of 'app' socket */ 633 /* signal thread that app is done by shutdown() of 'app' socket */
639 shutdown (urh->app.socket, 634 shutdown (urh->app.socket,
640 SHUT_RDWR); 635 SHUT_RDWR);
641 } 636 }
642#endif 637#endif
638 /* need to signal the thread that we are done */
639 MHD_semaphore_up (connection->upgrade_sem);
643 return MHD_YES; 640 return MHD_YES;
644 } 641 }
645#if HTTPS_SUPPORT 642#if HTTPS_SUPPORT
@@ -755,6 +752,12 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response,
755 urh->mhd.celi = MHD_EPOLL_STATE_UNREADY; 752 urh->mhd.celi = MHD_EPOLL_STATE_UNREADY;
756 pool = connection->pool; 753 pool = connection->pool;
757 avail = MHD_pool_get_free (pool); 754 avail = MHD_pool_get_free (pool);
755 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION) )
756 {
757 /* Need to give the thread something to block on... */
758 connection->upgrade_sem = MHD_semaphore_create (0);
759 }
760
758 if (avail < 8) 761 if (avail < 8)
759 { 762 {
760 /* connection's pool is totally at the limit, 763 /* connection's pool is totally at the limit,
@@ -871,7 +874,8 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response,
871 { 874 {
872 /* Need to give the thread something to block on... */ 875 /* Need to give the thread something to block on... */
873 connection->upgrade_sem = MHD_semaphore_create (0); 876 connection->upgrade_sem = MHD_semaphore_create (0);
874 if (NULL == connection->upgrade_sem) 877 connection->urh = urh;
878 if (NULL == connection->upgrade_sem)
875 { 879 {
876#ifdef HAVE_MESSAGES 880#ifdef HAVE_MESSAGES
877 MHD_DLOG (daemon, 881 MHD_DLOG (daemon,