From eea55aeb1d68159879e231ebfdb223bd21bdc525 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 4 Sep 2016 16:43:28 +0000 Subject: [PATCH] -fix where we init daemon --- src/microhttpd/connection.c | 2 +- src/microhttpd/test_upgrade_common.c | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 4677fa7a..bd8af585 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c @@ -3178,6 +3178,7 @@ MHD_queue_response (struct MHD_Connection *connection, ( (MHD_CONNECTION_HEADERS_PROCESSED != connection->state) && (MHD_CONNECTION_FOOTERS_RECEIVED != connection->state) ) ) return MHD_NO; + daemon = connection->daemon; if ( (MHD_HTTP_SWITCHING_PROTOCOLS != status_code) && (NULL != response->upgrade_handler) ) { @@ -3187,7 +3188,6 @@ MHD_queue_response (struct MHD_Connection *connection, #endif return MHD_NO; } - daemon = connection->daemon; if ( (NULL != response->upgrade_handler) && (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && (0 == (daemon->options & MHD_USE_SUSPEND_RESUME)) ) diff --git a/src/microhttpd/test_upgrade_common.c b/src/microhttpd/test_upgrade_common.c index 14336345..5ec45ec9 100644 --- a/src/microhttpd/test_upgrade_common.c +++ b/src/microhttpd/test_upgrade_common.c @@ -388,15 +388,16 @@ run_mhd_select_loop (struct MHD_Daemon *daemon) &es, &max_fd)) abort (); - MHD_get_timeout (daemon, - &to); + (void) MHD_get_timeout (daemon, + &to); tv.tv_sec = to / 1000; tv.tv_usec = 1000 * (to % 1000); - select (max_fd + 1, - &rs, - &ws, - &es, - &tv); + if (0 > MHD_SYS_select_ (max_fd + 1, + &rs, + &ws, + &es, + &tv)) + abort (); MHD_run_from_select (daemon, &rs, &ws, @@ -442,8 +443,8 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon) to = 1000; FD_SET (ep, &rs); - MHD_get_timeout (daemon, - &to); + (void) MHD_get_timeout (daemon, + &to); tv.tv_sec = to / 1000; tv.tv_usec = 1000 * (to % 1000); select (ep + 1,