From 1d0a545610416c33a64d19e85454393a42d0a09f Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Fri, 7 Jun 2024 11:54:50 +0200 Subject: [PATCH] async: Check if SSL layer is ready --- src/async.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/async.c b/src/async.c index 9009329..76d4193 100644 --- a/src/async.c +++ b/src/async.c @@ -19,6 +19,7 @@ #include #include #include +#include #define ASYNC_MAX_EVENTS 16 @@ -167,6 +168,11 @@ static int async_check(evt_listen_t *evt) { }}; // check, if fd is already ready + if (evt->events & ASYNC_IN && evt->socket && evt->socket->enc && SSL_pending(evt->socket->ssl) > 0) { + // ssl layer already ready + if (async_exec(evt, ASYNC_IN) == 0) + return 1; + } switch (poll(fds, 1, 0)) { case 1: // fd already ready