[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 01/03: connection cleanup: streamlined cleanup process
From: |
gnunet |
Subject: |
[libmicrohttpd] 01/03: connection cleanup: streamlined cleanup process |
Date: |
Sun, 01 Aug 2021 12:28:04 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit aadbe63575e1f2af75280d671fdf3da7ca31620b
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Jul 30 11:54:25 2021 +0300
connection cleanup: streamlined cleanup process
---
src/microhttpd/connection.c | 17 ++++++++++++-----
src/microhttpd/internal.h | 3 +--
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 21340001..a59e3d60 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -677,8 +677,6 @@ MHD_connection_mark_closed_ (struct MHD_Connection
*connection)
{
const struct MHD_Daemon *daemon = connection->daemon;
- connection->state = MHD_CONNECTION_CLOSED;
- connection->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP;
if (0 == (daemon->options & MHD_USE_TURBO))
{
#ifdef HTTPS_SUPPORT
@@ -698,6 +696,8 @@ MHD_connection_mark_closed_ (struct MHD_Connection
*connection)
shutdown (connection->socket_fd,
SHUT_WR);
}
+ connection->state = MHD_CONNECTION_CLOSED;
+ connection->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP;
}
@@ -733,6 +733,11 @@ MHD_connection_close_ (struct MHD_Connection *connection,
connection->response = NULL;
MHD_destroy_response (resp);
}
+ if (NULL != connection->pool)
+ {
+ MHD_pool_destroy (connection->pool);
+ connection->pool = NULL;
+ }
MHD_connection_mark_closed_ (connection);
}
@@ -3743,14 +3748,16 @@ connection_reset (struct MHD_Connection *connection,
if (! reuse)
{
/* Next function will destroy response, notify client,
- * and set state "CLOSED" */
+ * destroy memory pool, and set connection state to "CLOSED" */
MHD_connection_close_ (connection,
MHD_REQUEST_TERMINATED_COMPLETED_OK);
- MHD_pool_destroy (connection->pool);
- c->pool = NULL;
c->read_buffer = NULL;
c->read_buffer_size = 0;
c->read_buffer_offset = 0;
+ c->write_buffer = NULL;
+ c->write_buffer_size = 0;
+ c->write_buffer_send_offset = 0;
+ c->write_buffer_append_offset = 0;
}
else
{
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index d1f3b9ff..ad60502e 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1182,8 +1182,7 @@ struct MHD_Connection
bool in_idle;
/**
- * Are we currently inside the "idle" handler (to avoid recursively
- * invoking it).
+ * Connection is in the cleanup DL-linked list.
*/
bool in_cleanup;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.