diff options
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r-- | src/microhttpd/connection.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index efbe254d..8e348f25 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -2732,7 +2732,6 @@ int | |||
2732 | MHD_connection_handle_idle (struct MHD_Connection *connection) | 2732 | MHD_connection_handle_idle (struct MHD_Connection *connection) |
2733 | { | 2733 | { |
2734 | struct MHD_Daemon *daemon = connection->daemon; | 2734 | struct MHD_Daemon *daemon = connection->daemon; |
2735 | unsigned int timeout; | ||
2736 | const char *end; | 2735 | const char *end; |
2737 | char *line; | 2736 | char *line; |
2738 | size_t line_len; | 2737 | size_t line_len; |
@@ -2740,13 +2739,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
2740 | int ret; | 2739 | int ret; |
2741 | 2740 | ||
2742 | connection->in_idle = true; | 2741 | connection->in_idle = true; |
2743 | while (1) | 2742 | while (! connection->suspended) |
2744 | { | 2743 | { |
2745 | if (connection->suspended) | ||
2746 | { | ||
2747 | connection->in_idle = false; | ||
2748 | return MHD_YES; | ||
2749 | } | ||
2750 | #if DEBUG_STATES | 2744 | #if DEBUG_STATES |
2751 | MHD_DLOG (daemon, | 2745 | MHD_DLOG (daemon, |
2752 | _("In function %s handling connection at state: %s\n"), | 2746 | _("In function %s handling connection at state: %s\n"), |
@@ -3210,19 +3204,24 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
3210 | } | 3204 | } |
3211 | break; | 3205 | break; |
3212 | } | 3206 | } |
3213 | timeout = connection->connection_timeout; | 3207 | if (! connection->suspended) |
3214 | if ( (0 != timeout) && | ||
3215 | (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity)) ) | ||
3216 | { | 3208 | { |
3217 | MHD_connection_close_ (connection, | 3209 | unsigned int timeout; |
3218 | MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); | 3210 | timeout = connection->connection_timeout; |
3219 | connection->in_idle = false; | 3211 | if ( (0 != timeout) && |
3220 | return MHD_YES; | 3212 | (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity)) ) |
3213 | { | ||
3214 | MHD_connection_close_ (connection, | ||
3215 | MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); | ||
3216 | connection->in_idle = false; | ||
3217 | return MHD_YES; | ||
3218 | } | ||
3221 | } | 3219 | } |
3222 | MHD_connection_update_event_loop_info (connection); | 3220 | MHD_connection_update_event_loop_info (connection); |
3223 | ret = MHD_YES; | 3221 | ret = MHD_YES; |
3224 | #ifdef EPOLL_SUPPORT | 3222 | #ifdef EPOLL_SUPPORT |
3225 | if (0 != (daemon->options & MHD_USE_EPOLL)) | 3223 | if ( (! connection->suspended) && |
3224 | (0 != (daemon->options & MHD_USE_EPOLL)) | ||
3226 | { | 3225 | { |
3227 | ret = MHD_connection_epoll_update_ (connection); | 3226 | ret = MHD_connection_epoll_update_ (connection); |
3228 | } | 3227 | } |
@@ -3277,7 +3276,6 @@ MHD_connection_epoll_update_ (struct MHD_Connection *connection) | |||
3277 | } | 3276 | } |
3278 | connection->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET; | 3277 | connection->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET; |
3279 | } | 3278 | } |
3280 | connection->in_idle = false; | ||
3281 | return MHD_YES; | 3279 | return MHD_YES; |
3282 | } | 3280 | } |
3283 | #endif | 3281 | #endif |