]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC APL: Add support for registering blocking operations to support polling code
authorHugo Landau <hlandau@openssl.org>
Mon, 13 May 2024 19:20:23 +0000 (20:20 +0100)
committerNeil Horman <nhorman@openssl.org>
Sat, 11 Jan 2025 21:02:29 +0000 (16:02 -0500)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25416)

include/internal/quic_ssl.h
ssl/quic/quic_impl.c

index 2848945cd409baf1aaf59ec9314a683305e08163..a470d146575ecb7792e4fad52f4228125a27dab7 100644 (file)
@@ -153,6 +153,9 @@ int ossl_quic_set_diag_title(SSL_CTX *ctx, const char *title);
 /* APIs used by the polling infrastructure */
 int ossl_quic_conn_poll_events(SSL *ssl, uint64_t events, int do_tick,
                                uint64_t *revents);
+int ossl_quic_get_notifier_fd(SSL *ssl);
+void ossl_quic_enter_blocking_section(SSL *ssl, QUIC_REACTOR_WAIT_CTX *wctx);
+void ossl_quic_leave_blocking_section(SSL *ssl, QUIC_REACTOR_WAIT_CTX *wctx);
 
 # endif
 
index 3d05acff2bd55977826aaabc4157201a62d04585..0b4252eae3faa0e8d9c1b11eb1c80bd5aac2a31a 100644 (file)
@@ -18,6 +18,7 @@
 #include "internal/quic_error.h"
 #include "internal/quic_engine.h"
 #include "internal/quic_port.h"
+#include "internal/quic_reactor_wait_ctx.h"
 #include "internal/time.h"
 
 typedef struct qctx_st QCTX;
@@ -4831,6 +4832,47 @@ int ossl_quic_conn_poll_events(SSL *ssl, uint64_t events, int do_tick,
     return 1;
 }
 
+int ossl_quic_get_notifier_fd(SSL *ssl)
+{
+    QCTX ctx;
+    QUIC_REACTOR *rtor;
+    RIO_NOTIFIER *nfy;
+
+    if (!expect_quic_any(ssl, &ctx))
+        return -1;
+
+    rtor = ossl_quic_obj_get0_reactor(ctx.obj);
+    nfy = ossl_quic_reactor_get0_notifier(rtor);
+    if (nfy == NULL)
+        return -1;
+
+    return ossl_rio_notifier_as_fd(nfy);
+}
+
+void ossl_quic_enter_blocking_section(SSL *ssl, QUIC_REACTOR_WAIT_CTX *wctx)
+{
+    QCTX ctx;
+    QUIC_REACTOR *rtor;
+
+    if (!expect_quic_any(ssl, &ctx))
+        return;
+
+    rtor = ossl_quic_obj_get0_reactor(ctx.obj);
+    ossl_quic_reactor_wait_ctx_enter(wctx, rtor);
+}
+
+void ossl_quic_leave_blocking_section(SSL *ssl, QUIC_REACTOR_WAIT_CTX *wctx)
+{
+    QCTX ctx;
+    QUIC_REACTOR *rtor;
+
+    if (!expect_quic_any(ssl, &ctx))
+        return;
+
+    rtor = ossl_quic_obj_get0_reactor(ctx.obj);
+    ossl_quic_reactor_wait_ctx_leave(wctx, rtor);
+}
+
 /*
  * Internal Testing APIs
  * =====================