]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Always tick the QUIC_ENGINE regardless of the state of a connection
authorMatt Caswell <matt@openssl.org>
Thu, 12 Sep 2024 14:05:59 +0000 (15:05 +0100)
committerNeil Horman <nhorman@openssl.org>
Mon, 17 Feb 2025 16:27:33 +0000 (11:27 -0500)
Just because one connection has not started yet, it does not mean that
we should not tick the QUIC_ENGINE. There may be other connections that do
need ticking.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25452)

ssl/quic/quic_channel.c
ssl/quic/quic_impl.c

index 04fb1c3ad9765574b927b699848657fb3ee3a018..02c1213cd5737bc7e7b661817969f736ad21a817 100644 (file)
@@ -1890,12 +1890,12 @@ void ossl_quic_channel_subtick(QUIC_CHANNEL *ch, QUIC_TICK_RESULT *res,
      *   - determine the time at which we should next be ticked.
      */
 
-    /* Nothing to do yet if connection has not been started. */
-    if (ch->state == QUIC_CHANNEL_STATE_IDLE)
-        return;
-
-    /* If we are in the TERMINATED state, there is nothing to do. */
-    if (ossl_quic_channel_is_terminated(ch)) {
+    /*
+     * If the connection has not yet started, or we are in the TERMINATED state,
+     * there is nothing to do.
+     */
+    if (ch->state == QUIC_CHANNEL_STATE_IDLE
+            || ossl_quic_channel_is_terminated(ch)) {
         res->net_read_desired       = 0;
         res->net_write_desired      = 0;
         res->notify_other_threads   = 0;
index 6df980dbfb1279c61270922f67b4df53af58aac8..825fd4c473741de868e50481473c13b7805fb4e4 100644 (file)
@@ -1280,14 +1280,7 @@ int ossl_quic_handle_events(SSL *s)
         return 0;
 
     qctx_lock(&ctx);
-    /*
-     * TODO(QUIC SERVER): We should always tick the engine, whether the current
-     * connection is started or not.  When ticking the engine, we MUST avoid
-     * inadvertently starting connections that haven't started, the guards
-     * don't belong here.
-     */
-    if (ctx.qc == NULL || ctx.qc->started)
-        ossl_quic_reactor_tick(ossl_quic_obj_get0_reactor(ctx.obj), 0);
+    ossl_quic_reactor_tick(ossl_quic_obj_get0_reactor(ctx.obj), 0);
     qctx_unlock(&ctx);
     return 1;
 }
@@ -4776,6 +4769,9 @@ int ossl_quic_conn_poll_events(SSL *ssl, uint64_t events, int do_tick,
 
     qctx_lock(&ctx);
 
+    if (do_tick)
+        ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(ctx.qc->ch), 0);
+
     if (!ctx.qc->started) {
         /* We can only try to write on non-started connection. */
         if ((events & SSL_POLL_EVENT_W) != 0)
@@ -4783,9 +4779,6 @@ int ossl_quic_conn_poll_events(SSL *ssl, uint64_t events, int do_tick,
         goto end;
     }
 
-    if (do_tick)
-        ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(ctx.qc->ch), 0);
-
     if (ctx.xso != NULL) {
         /* SSL object has a stream component. */