QUIC REACTOR: Add utility function for merging tick results
authorHugo Landau <hlandau@openssl.org>
Thu, 9 Nov 2023 10:27:13 +0000 (10:27 +0000)
committerHugo Landau <hlandau@openssl.org>
Thu, 21 Dec 2023 08:11:59 +0000 (08:11 +0000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22674)

include/internal/quic_reactor.h

index 57bb551e27a222871758e09ebba4d2e74bd142e2..bffbf50d8be1e214c99fde4957d81c9e22323b9a 100644 (file)
@@ -73,6 +73,15 @@ typedef struct quic_tick_result_st {
     OSSL_TIME   tick_deadline;
 } QUIC_TICK_RESULT;
 
+static ossl_inline ossl_unused void
+ossl_quic_tick_result_merge_into(QUIC_TICK_RESULT *r,
+                                 const QUIC_TICK_RESULT *src)
+{
+    r->net_read_desired  = r->net_read_desired  || src->net_read_desired;
+    r->net_write_desired = r->net_write_desired || src->net_write_desired;
+    r->tick_deadline     = ossl_time_min(r->tick_deadline, src->tick_deadline);
+}
+
 typedef struct quic_reactor_st {
     /*
      * BIO poll descriptors which can be polled. poll_r is a poll descriptor