]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
SSL_poll(): Report result_count for failed events
authorTomas Mraz <tomas@openssl.org>
Tue, 10 Sep 2024 07:10:53 +0000 (09:10 +0200)
committerNeil Horman <nhorman@openssl.org>
Mon, 17 Feb 2025 16:27:33 +0000 (11:27 -0500)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25416)

ssl/rio/poll_immediate.c

index e1bc2391177233aceb26fd6be9b3f72ad71aa6b2..76b2db7a807a72c3ef04b518f3544234d3df59ac 100644 (file)
@@ -32,6 +32,7 @@
 #define FAIL_ITEM(idx)                                                      \
     do {                                                                    \
         size_t idx_ = (idx);                                                \
+                                                                            \
         ITEM_N(items, stride, idx_).revents = SSL_POLL_EVENT_F;             \
         ++result_count;                                                     \
         FAIL_FROM(idx_ + 1);                                                \
@@ -190,7 +191,8 @@ static int poll_translate(SSL_POLL_ITEM *items,
                           QUIC_REACTOR_WAIT_CTX *wctx,
                           RIO_POLL_BUILDER *rpb,
                           OSSL_TIME *p_earliest_wakeup_deadline,
-                          int *abort_blocking)
+                          int *abort_blocking,
+                          size_t *p_result_count)
 {
     int ok = 1;
     SSL_POLL_ITEM *item;
@@ -262,13 +264,15 @@ out:
         postpoll_translation_cleanup(items, i, stride, wctx);
 
     *p_earliest_wakeup_deadline = earliest_wakeup_deadline;
+    *p_result_count = result_count;
     return ok;
 }
 
 static int poll_block(SSL_POLL_ITEM *items,
                       size_t num_items,
                       size_t stride,
-                      OSSL_TIME user_deadline)
+                      OSSL_TIME user_deadline,
+                      size_t *p_result_count)
 {
     int ok = 0, abort_blocking = 0;
     RIO_POLL_BUILDER rpb;
@@ -301,7 +305,8 @@ static int poll_block(SSL_POLL_ITEM *items,
 
     if (!poll_translate(items, num_items, stride, &wctx, &rpb,
                         &earliest_wakeup_deadline,
-                        &abort_blocking))
+                        &abort_blocking,
+                        p_result_count))
         goto out;
 
     if (abort_blocking)
@@ -423,7 +428,6 @@ int SSL_poll(SSL_POLL_ITEM *items,
     for (;;) {
         /* Readout phase - poll current state of each item. */
         if (!poll_readout(items, num_items, stride, do_tick, &result_count)) {
-            result_count = 0;
             ok = 0;
             goto out;
         }