[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 02/03: MHD_connection_handle_idle(): better
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 02/03: MHD_connection_handle_idle(): better handle suspended connections, prevent suspended connection closure by timeout. |
Date: |
Wed, 15 Mar 2017 21:37:42 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 681000855a41e11a06f8ba22b7afffb7bb15811c
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Wed Mar 15 23:22:44 2017 +0300
MHD_connection_handle_idle(): better handle suspended connections,
prevent suspended connection closure by timeout.
---
src/microhttpd/connection.c | 30 ++++++++++++++----------------
1 file 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
MHD_connection_handle_idle (struct MHD_Connection *connection)
{
struct MHD_Daemon *daemon = connection->daemon;
- unsigned int timeout;
const char *end;
char *line;
size_t line_len;
@@ -2740,13 +2739,8 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
int ret;
connection->in_idle = true;
- while (1)
+ while (! connection->suspended)
{
- if (connection->suspended)
- {
- connection->in_idle = false;
- return MHD_YES;
- }
#if DEBUG_STATES
MHD_DLOG (daemon,
_("In function %s handling connection at state: %s\n"),
@@ -3210,19 +3204,24 @@ MHD_connection_handle_idle (struct MHD_Connection
*connection)
}
break;
}
- timeout = connection->connection_timeout;
- if ( (0 != timeout) &&
- (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity)) )
+ if (! connection->suspended)
{
- MHD_connection_close_ (connection,
- MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
- connection->in_idle = false;
- return MHD_YES;
+ unsigned int timeout;
+ timeout = connection->connection_timeout;
+ if ( (0 != timeout) &&
+ (timeout <= (MHD_monotonic_sec_counter() -
connection->last_activity)) )
+ {
+ MHD_connection_close_ (connection,
+ MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
+ connection->in_idle = false;
+ return MHD_YES;
+ }
}
MHD_connection_update_event_loop_info (connection);
ret = MHD_YES;
#ifdef EPOLL_SUPPORT
- if (0 != (daemon->options & MHD_USE_EPOLL))
+ if ( (! connection->suspended) &&
+ (0 != (daemon->options & MHD_USE_EPOLL))
{
ret = MHD_connection_epoll_update_ (connection);
}
@@ -3277,7 +3276,6 @@ MHD_connection_epoll_update_ (struct MHD_Connection
*connection)
}
connection->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET;
}
- connection->in_idle = false;
return MHD_YES;
}
#endif
--
To stop receiving notification emails like this one, please contact
address@hidden