diff --git a/src/waltz/quic/fd_quic.c b/src/waltz/quic/fd_quic.c index 78d4bfd22c..0a683c8310 100644 --- a/src/waltz/quic/fd_quic.c +++ b/src/waltz/quic/fd_quic.c @@ -55,7 +55,6 @@ struct fd_quic_layout { ulong tls_off; /* offset of fd_quic_tls_t */ ulong stream_pool_off; /* offset of the stream pool */ ulong cs_tree_off; /* offset of the cs_tree */ - ulong rng_off; /* offset of the rng */ }; typedef struct fd_quic_layout fd_quic_layout_t; @@ -142,13 +141,6 @@ fd_quic_footprint_ext( fd_quic_limits_t const * limits, if( FD_UNLIKELY( !cs_tree_footprint ) ) { FD_LOG_WARNING(( "invalid fd_quic_cs_tree_footprint" )); return 0UL; } offs += cs_tree_footprint; - /* allocate space for fd_rng_t */ - offs = fd_ulong_align_up( offs, fd_rng_align() ); - layout->rng_off = offs; - ulong rng_footprint = fd_rng_footprint(); - if( FD_UNLIKELY( !rng_footprint ) ) { FD_LOG_WARNING(( "invalid fd_rng_t" )); return 0UL; } - offs += rng_footprint; - return offs; } @@ -485,8 +477,7 @@ fd_quic_init( fd_quic_t * quic ) { state->cs_tree = (fd_quic_cs_tree_t*)cs_tree_laddr; fd_quic_cs_tree_init( state->cs_tree, ( limits->conn_cnt << 1UL ) + 1UL ); - ulong rng_laddr = (ulong)quic + layout.rng_off; - state->rng = fd_rng_join( fd_rng_new( (void*)rng_laddr, 0UL, 0UL ) ); + fd_rng_new( state->_rng, 0UL, 0UL ); /* Initialize crypto */ @@ -6854,7 +6845,7 @@ fd_quic_assign_streams( fd_quic_t * quic ) { fd_quic_state_t * state = fd_quic_get_state( quic ); fd_quic_cs_tree_t * cs_tree = state->cs_tree; fd_quic_stream_pool_t * stream_pool = state->stream_pool; - fd_rng_t * rng = state->rng; + fd_rng_t * rng = fd_rng_join( state->_rng ); /* we want to reserve 1 stream for each connection */ /* TODO could add a config for larger reservations */ @@ -6907,6 +6898,8 @@ fd_quic_assign_streams( fd_quic_t * quic ) { avail_streams--; } + + fd_rng_leave( rng ); } @@ -7026,7 +7019,8 @@ fd_quic_cs_tree_update( fd_quic_cs_tree_t * cs_tree, ulong idx, ulong new_value ulong -fd_quic_choose_weighted_index( fd_quic_cs_tree_t * cs_tree, fd_rng_t * rng ) { +fd_quic_choose_weighted_index( fd_quic_cs_tree_t * cs_tree, + fd_rng_t * rng ) { ulong cnt = cs_tree->cnt; ulong * values = cs_tree->values; ulong node_idx = 1UL; diff --git a/src/waltz/quic/fd_quic.h b/src/waltz/quic/fd_quic.h index a30affe651..cca59a8b6b 100644 --- a/src/waltz/quic/fd_quic.h +++ b/src/waltz/quic/fd_quic.h @@ -85,8 +85,6 @@ #include "../aio/fd_aio.h" #include "../tls/fd_tls.h" -#include "../../util/fd_util.h" -#include "../../util/rng/fd_rng.h" /* FD_QUIC_API marks public API declarations. No-op for now. */ #define FD_QUIC_API diff --git a/src/waltz/quic/fd_quic_private.h b/src/waltz/quic/fd_quic_private.h index b721b282c6..8859461881 100644 --- a/src/waltz/quic/fd_quic_private.h +++ b/src/waltz/quic/fd_quic_private.h @@ -88,7 +88,7 @@ struct __attribute__((aligned(16UL))) fd_quic_state_private { fd_quic_stream_pool_t * stream_pool; /* stream pool */ fd_quic_cs_tree_t * cs_tree; /* cummulative summation tree */ - fd_rng_t * rng; /* random number generator */ + fd_rng_t _rng[1]; /* random number generator */ /* need to be able to access connections by index */ ulong conn_base; /* address of array of all connections */