[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] branch master updated (ac82c4d3 -> 93331888
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] branch master updated (ac82c4d3 -> 93331888) |
Date: |
Thu, 16 Mar 2017 20:44:18 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a change to branch master
in repository libmicrohttpd.
from ac82c4d3 Improved thread-safe for MHD_set_connection_option()
new 605bb70b HTTPS connection: fixed double processing of timeout
new 396aab2e Do not update last activity time on connections without
timeout timer
new 0a053335 Fixed reset of timeout timer on resumed connections.
new 93331888 Updated ChangeLog
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
ChangeLog | 9 +++++++++
src/include/microhttpd.h | 2 ++
src/microhttpd/connection.c | 11 +++++++++--
src/microhttpd/connection.h | 2 +-
src/microhttpd/connection_https.c | 10 +++++-----
src/microhttpd/daemon.c | 4 ++++
6 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5b40fb1d..08814edb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Thu Mar 16 22:31:54 MSK 2017
+ Unified update of last activity on connections.
+ Update last activity only if something is really transmitted.
+ Update last activity each time when something is transmitted.
+ Removed early duplicated check for timeout on HTTPS connections.
+ Removed update of last active time for connections without timeout.
+ Fixed reset of timeout timer on resumed connections.
+ Fixed thread-safety of MHD_set_connection_option(). -EG
+
Thu Mar 16 21:05:08 MSK 2017
Fixed minor bug resulted in slight slowdown of HTTPS connection
handshake. -EG
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 4749a6ee..a09cddf3 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -3143,6 +3143,8 @@ enum MHD_CONNECTION_OPTION
* Set a custom timeout for the given connection. Specified
* as the number of seconds, given as an `unsigned int`. Use
* zero for no timeout.
+ * If timeout was set to zero (or unset) before, setup of new value by
+ * MHD_set_connection_option() will reset timeout timer.
*/
MHD_CONNECTION_OPTION_TIMEOUT
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index c3c7be8b..a883e4d9 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2373,11 +2373,15 @@ MHD_update_last_activity_ (struct MHD_Connection
*connection)
{
struct MHD_Daemon *daemon = connection->daemon;
+ if (0 == connection->connection_timeout)
+ return; /* Skip update of activity for connections
+ without timeout timer. */
+ if (connection->suspended)
+ return; /* no activity on suspended connections */
+
connection->last_activity = MHD_monotonic_sec_counter();
if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
return; /* each connection has personal timeout */
- if (connection->suspended)
- return; /* not timeouts for suspended connections */
if (connection->connection_timeout != daemon->connection_timeout)
return; /* custom timeout, no need to move it in "normal" DLL */
@@ -3373,6 +3377,9 @@ MHD_set_connection_option (struct MHD_Connection
*connection,
switch (option)
{
case MHD_CONNECTION_OPTION_TIMEOUT:
+ if (0 == connection->connection_timeout)
+ connection->last_activity = MHD_monotonic_sec_counter();
+
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(! connection->suspended) )
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index 0bd891d9..d885f3f7 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -142,6 +142,6 @@ MHD_connection_epoll_update_ (struct MHD_Connection
*connection);
* @param connection the connection that saw some activity
*/
void
-update_last_activity (struct MHD_Connection *connection);
+MHD_update_last_activity_ (struct MHD_Connection *connection);
#endif
diff --git a/src/microhttpd/connection_https.c
b/src/microhttpd/connection_https.c
index 5a05bf3b..2c5e2588 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -142,11 +142,6 @@ MHD_tls_connection_handle_idle (struct MHD_Connection
*connection)
#endif
if (connection->suspended)
return MHD_connection_handle_idle (connection);
- timeout = connection->connection_timeout;
- if ( (timeout != 0) &&
- (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity)))
- MHD_connection_close_ (connection,
- MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
switch (connection->state)
{
/* on newly created connections we might reach here before any reply has
been received */
@@ -158,6 +153,11 @@ MHD_tls_connection_handle_idle (struct MHD_Connection
*connection)
default:
return MHD_connection_handle_idle (connection);
}
+ timeout = connection->connection_timeout;
+ if ( (timeout != 0) &&
+ (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity)))
+ MHD_connection_close_ (connection,
+ MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
#ifdef EPOLL_SUPPORT
return MHD_connection_epoll_update_ (connection);
#else
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index a93a2ac0..23c48be8 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2860,6 +2860,10 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
pos);
if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
{
+ /* Reset timeout timer on resume. */
+ if (0 != pos->connection_timeout)
+ pos->last_activity = MHD_monotonic_sec_counter();
+
if (pos->connection_timeout == daemon->connection_timeout)
XDLL_insert (daemon->normal_timeout_head,
daemon->normal_timeout_tail,
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [libmicrohttpd] branch master updated (ac82c4d3 -> 93331888),
gnunet <=