[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 01/02: Unified update of connection activit
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 01/02: Unified update of connection activity. |
Date: |
Thu, 16 Mar 2017 19:49:19 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 7d4e3953b7667c87a766c9665d49458d2e60f229
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Thu Mar 16 21:28:32 2017 +0300
Unified update of connection activity.
---
src/microhttpd/connection.c | 8 ++++----
src/microhttpd/connection.h | 9 +++++++++
src/microhttpd/connection_https.c | 2 +-
src/microhttpd/daemon.c | 5 ++---
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 7740e0e7..e29cca43 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2368,8 +2368,8 @@ parse_connection_headers (struct MHD_Connection
*connection)
*
* @param connection the connection that saw some activity
*/
-static void
-update_last_activity (struct MHD_Connection *connection)
+void
+MHD_update_last_activity_ (struct MHD_Connection *connection)
{
struct MHD_Daemon *daemon = connection->daemon;
@@ -2405,7 +2405,7 @@ update_last_activity (struct MHD_Connection *connection)
int
MHD_connection_handle_read (struct MHD_Connection *connection)
{
- update_last_activity (connection);
+ MHD_update_last_activity_ (connection);
if ( (MHD_CONNECTION_CLOSED == connection->state) ||
(connection->suspended) )
return MHD_YES;
@@ -2480,7 +2480,7 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
if (connection->suspended)
return MHD_YES;
- update_last_activity (connection);
+ MHD_update_last_activity_ (connection);
while (1)
{
#if DEBUG_STATES
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index ffbc5b80..0bd891d9 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -134,5 +134,14 @@ int
MHD_connection_epoll_update_ (struct MHD_Connection *connection);
#endif
+/**
+ * Update the 'last_activity' field of the connection to the current time
+ * and move the connection to the head of the 'normal_timeout' list if
+ * the timeout for the connection uses the default value.
+ *
+ * @param connection the connection that saw some activity
+ */
+void
+update_last_activity (struct MHD_Connection *connection);
#endif
diff --git a/src/microhttpd/connection_https.c
b/src/microhttpd/connection_https.c
index c4eb835d..0f995d67 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -48,7 +48,7 @@ run_tls_handshake (struct MHD_Connection *connection)
{
int ret;
- connection->last_activity = MHD_monotonic_sec_counter ();
+ MHD_update_last_activity_ (connection);
if (MHD_TLS_CONNECTION_INIT == connection->state)
{
ret = gnutls_handshake (connection->tls_session);
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index d3b02c27..a93a2ac0 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1865,10 +1865,9 @@ thread_main_handle_connection (void *data)
continue; /* Check again for resume. */
} /* End of "suspended" branch. */
- if ( (was_suspended) &&
- (0 != con->connection_timeout) )
+ if (was_suspended)
{
- con->last_activity = MHD_monotonic_sec_counter(); /* Reset timeout
timer. */
+ MHD_update_last_activity_ (con); /* Reset timeout timer. */
was_suspended = false;
}
--
To stop receiving notification emails like this one, please contact
address@hidden