Commit 271222650b for openssl.org

commit 271222650b44fcb931866d1e9c2ff61cc9b6c677
Author: Jakub Zelenka <jakub.zelenka@openssl.foundation>
Date:   Thu Aug 27 18:46:18 2026 +0200

    dtls: fix flaky cookie exchange loop in listener test

    drive_until_connection_queued() spun through its iterations with a
    zero-timeout poll and no waiting, so over real loopback sockets the loop
    could run dry in microseconds if a datagram was not yet readable. On
    macOS loopback delivery is asynchronous, which made the blocking mode
    tests fail intermittently on slow runners with "cookie exchange loop did
    not converge". Sleep between iterations so a delayed datagram can arrive,
    and raise the iteration cap so the budget also covers the client's 1s
    initial retransmit timer if a datagram is lost outright.

    Assisted-by: Claude:claude-fable-5
    Reviewed-by: Richard Levitte <levitte@openssl.org>
    Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
    Merge-date: Tue Sep  1 14:42:31 2026
    Merged-from: https://github.com/openssl/openssl/pull/32551

diff --git a/test/dtlsssllistenertest.c b/test/dtlsssllistenertest.c
index ad82aef713..e173a9b8cd 100644
--- a/test/dtlsssllistenertest.c
+++ b/test/dtlsssllistenertest.c
@@ -5412,7 +5412,7 @@ static int drive_until_connection_queued(SSL *listener, SSL *clientssl)

     SSL_set_connect_state(clientssl);

-    for (abortctr = 0; abortctr < 100; abortctr++) {
+    for (abortctr = 0; abortctr < 200; abortctr++) {
         retc = SSL_connect(clientssl);
         err_code = SSL_get_error(clientssl, retc);
         if (retc <= 0
@@ -5432,6 +5432,9 @@ static int drive_until_connection_queued(SSL *listener, SSL *clientssl)

         if ((poll_item.revents & SSL_POLL_EVENT_IC) != 0)
             return 1;
+
+        /* Loopback delivery can lag and a lost datagram needs a retransmit */
+        OSSL_sleep(10);
     }

     TEST_error("cookie exchange loop did not converge");