[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 02/02: Update connection last activity if a
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 02/02: Update connection last activity if and only if any data was received or transmitted. |
Date: |
Thu, 16 Mar 2017 19:49:20 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 76500135fe570921bc86093bb84872e17f1fe1cb
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Thu Mar 16 21:48:59 2017 +0300
Update connection last activity if and only if any data was received or
transmitted.
---
ChangeLog | 4 ++++
src/microhttpd/connection.c | 16 ++++++++++------
src/microhttpd/connection_https.c | 2 +-
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 882c9598..5b40fb1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Mar 16 21:05:08 MSK 2017
+ Fixed minor bug resulted in slight slowdown of HTTPS connection
+ handshake. -EG
+
Thu Mar 16 20:35:59 MSK 2017
Improved thread-safety for DL-lists. -EG
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index e29cca43..20bde652 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2405,7 +2405,6 @@ MHD_update_last_activity_ (struct MHD_Connection
*connection)
int
MHD_connection_handle_read (struct MHD_Connection *connection)
{
- MHD_update_last_activity_ (connection);
if ( (MHD_CONNECTION_CLOSED == connection->state) ||
(connection->suspended) )
return MHD_YES;
@@ -2416,6 +2415,7 @@ MHD_connection_handle_read (struct MHD_Connection
*connection)
try_grow_read_buffer (connection);
if (MHD_NO == do_read (connection))
return MHD_YES;
+ MHD_update_last_activity_ (connection);
while (1)
{
#if DEBUG_STATES
@@ -2480,7 +2480,6 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
if (connection->suspended)
return MHD_YES;
- MHD_update_last_activity_ (connection);
while (1)
{
#if DEBUG_STATES
@@ -2529,6 +2528,7 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
&HTTP_100_CONTINUE[connection->continue_message_write_offset]);
#endif
connection->continue_message_write_offset += ret;
+ MHD_update_last_activity_ (connection);
break;
case MHD_CONNECTION_CONTINUE_SENT:
case MHD_CONNECTION_BODY_RECEIVED:
@@ -2537,7 +2537,8 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
EXTRA_CHECK (0);
break;
case MHD_CONNECTION_HEADERS_SENDING:
- do_write (connection);
+ if (MHD_NO != do_write (connection))
+ MHD_update_last_activity_ (connection);
if (MHD_CONNECTION_HEADERS_SENDING != connection->state)
break;
check_write_done (connection,
@@ -2569,7 +2570,6 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
[(size_t)data_write_offset],
response->data_size -
(size_t)data_write_offset);
- err = MHD_socket_get_error_ ();
#if DEBUG_SEND_DATA
if (ret > 0)
fprintf (stderr,
@@ -2583,6 +2583,7 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
MHD_mutex_unlock_chk_ (&response->mutex);
if (ret < 0)
{
+ err = MHD_socket_get_error_ ();
if (MHD_SCKT_ERR_IS_EINTR_ (err) ||
MHD_SCKT_ERR_IS_EAGAIN_ (err))
return MHD_YES;
@@ -2597,6 +2598,7 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
return MHD_YES;
}
connection->response_write_position += ret;
+ MHD_update_last_activity_ (connection);
}
if (connection->response_write_position ==
connection->response->total_size)
@@ -2606,7 +2608,8 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
EXTRA_CHECK (0);
break;
case MHD_CONNECTION_CHUNKED_BODY_READY:
- do_write (connection);
+ if (MHD_NO != do_write (connection))
+ MHD_update_last_activity_ (connection);
if (MHD_CONNECTION_CHUNKED_BODY_READY != connection->state)
break;
check_write_done (connection,
@@ -2620,7 +2623,8 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
EXTRA_CHECK (0);
break;
case MHD_CONNECTION_FOOTERS_SENDING:
- do_write (connection);
+ if (MHD_NO != do_write (connection))
+ MHD_update_last_activity_ (connection);
if (MHD_CONNECTION_FOOTERS_SENDING != connection->state)
break;
check_write_done (connection,
diff --git a/src/microhttpd/connection_https.c
b/src/microhttpd/connection_https.c
index 0f995d67..5a05bf3b 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -48,7 +48,6 @@ run_tls_handshake (struct MHD_Connection *connection)
{
int ret;
- MHD_update_last_activity_ (connection);
if (MHD_TLS_CONNECTION_INIT == connection->state)
{
ret = gnutls_handshake (connection->tls_session);
@@ -56,6 +55,7 @@ run_tls_handshake (struct MHD_Connection *connection)
{
/* set connection state to enable HTTP processing */
connection->state = MHD_CONNECTION_INIT;
+ MHD_update_last_activity_ (connection);
return MHD_NO;
}
if ( (GNUTLS_E_AGAIN == ret) ||
--
To stop receiving notification emails like this one, please contact
address@hidden