Fix intermittent sslapitest early data related failures
[openssl.git] / test / quic_txp_test.c
index 423d28ddcbb4747b0f00b397340262a5e8ed8177..f234fb683ac9199d4d3c449ae849a838d5357b62 100644 (file)
@@ -108,6 +108,17 @@ static void helper_cleanup(struct helper *h)
     BIO_free(h->bio2);
 }
 
+static void demux_default_handler(QUIC_URXE *e, void *arg,
+                                  const QUIC_CONN_ID *dcid)
+{
+    struct helper *h = arg;
+
+    if (dcid == NULL || !ossl_quic_conn_id_eq(dcid, &dcid_1))
+        return;
+
+    ossl_qrx_inject_urxe(h->qrx, e);
+}
+
 static int helper_init(struct helper *h)
 {
     int rc = 0;
@@ -204,6 +215,8 @@ static int helper_init(struct helper *h)
                                                  fake_now, NULL)))
         goto err;
 
+    ossl_quic_demux_set_default_handler(h->demux, demux_default_handler, h);
+
     h->qrx_args.demux                  = h->demux;
     h->qrx_args.short_conn_id_len      = 8;
     h->qrx_args.max_deferred           = 32;
@@ -211,9 +224,6 @@ static int helper_init(struct helper *h)
     if (!TEST_ptr(h->qrx = ossl_qrx_new(&h->qrx_args)))
         goto err;
 
-    if (!TEST_true(ossl_qrx_add_dst_conn_id(h->qrx, &dcid_1)))
-        goto err;
-
     ossl_qrx_allow_1rtt_processing(h->qrx);
 
     rc = 1;