[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 02/02: MHD_epoll: handle timeout before data processing
From: |
gnunet |
Subject: |
[libmicrohttpd] 02/02: MHD_epoll: handle timeout before data processing Connection should not timeout if it gets new data while processing data on other connections |
Date: |
Wed, 07 Oct 2020 20:38:57 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 1125f7dd9fc64b0577f7ba6b41567c7e4b2e5e88
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Oct 7 21:26:33 2020 +0300
MHD_epoll: handle timeout before data processing
Connection should not timeout if it gets new data while processing data on
other connections
---
src/microhttpd/daemon.c | 52 +++++++++++++++++++++++++------------------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index f1c1350a..22b0a775 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -4592,6 +4592,33 @@ MHD_epoll (struct MHD_Daemon *daemon,
series_length++;
}
+ /* Handle timed-out connections; we need to do this here
+ as the epoll mechanism won't call the 'MHD_connection_handle_idle()' on
everything,
+ as the other event loops do. As timeouts do not get an explicit
+ event, we need to find those connections that might have timed out
+ here.
+
+ Connections with custom timeouts must all be looked at, as we
+ do not bother to sort that (presumably very short) list. */
+ prev = daemon->manual_timeout_tail;
+ while (NULL != (pos = prev))
+ {
+ prev = pos->prevX;
+ MHD_connection_handle_idle (pos);
+ }
+ /* Connections with the default timeout are sorted by prepending
+ them to the head of the list whenever we touch the connection;
+ thus it suffices to iterate from the tail until the first
+ connection is NOT timed out */
+ prev = daemon->normal_timeout_tail;
+ while (NULL != (pos = prev))
+ {
+ prev = pos->prevX;
+ MHD_connection_handle_idle (pos);
+ if (MHD_CONNECTION_CLOSED != pos->state)
+ break; /* sorted by timeout, no need to visit the rest! */
+ }
+
#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
if (run_upgraded || (NULL != daemon->eready_urh_head))
run_epoll_for_upgrade (daemon);
@@ -4624,31 +4651,6 @@ MHD_epoll (struct MHD_Daemon *daemon,
}
}
- /* Finally, handle timed-out connections; we need to do this here
- as the epoll mechanism won't call the 'MHD_connection_handle_idle()' on
everything,
- as the other event loops do. As timeouts do not get an explicit
- event, we need to find those connections that might have timed out
- here.
-
- Connections with custom timeouts must all be looked at, as we
- do not bother to sort that (presumably very short) list. */prev =
daemon->manual_timeout_tail;
- while (NULL != (pos = prev))
- {
- prev = pos->prevX;
- MHD_connection_handle_idle (pos);
- }
- /* Connections with the default timeout are sorted by prepending
- them to the head of the list whenever we touch the connection;
- thus it suffices to iterate from the tail until the first
- connection is NOT timed out */
- prev = daemon->normal_timeout_tail;
- while (NULL != (pos = prev))
- {
- prev = pos->prevX;
- MHD_connection_handle_idle (pos);
- if (MHD_CONNECTION_CLOSED != pos->state)
- break; /* sorted by timeout, no need to visit the rest! */
- }
return MHD_YES;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.