commit 47f1d52e799227322c83d3114d3a6b7b54d2e5dd
parent 7a0929e352f4320add587e7e6e14c109e8b388ee
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Tue, 1 Nov 2016 19:58:59 +0300
Fixed processing "upgraded" TLS with epoll().
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -3568,6 +3568,13 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
struct UpgradeEpollHandle * const ueh = events[i].data.ptr;
struct MHD_UpgradeResponseHandle * const urh = ueh->urh;
+ /* Each MHD_UpgradeResponseHandle can be processed two times:
+ * one for TLS data and one for socketpair data.
+ * If forwarding was finished on first time, second time must
+ * be skipped as urh must not be used anymore. */
+ if (MHD_NO != urh->clean_ready)
+ continue;
+
/* Update our state based on what is ready according to epoll() */
if (0 != (events[i].events & EPOLLIN))
ueh->celi |= MHD_EPOLL_STATE_READ_READY;