QUIC CHANNEL, PORT: Abstract time retrieval

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22674)
This commit is contained in:
Hugo Landau 2023-11-09 10:27:13 +00:00
parent 34fa182e1d
commit f98bc5c95b
3 changed files with 12 additions and 8 deletions

View File

@ -80,6 +80,9 @@ QUIC_DEMUX *ossl_quic_port_get0_demux(QUIC_PORT *port);
/* Gets the mutex used by the port. */
CRYPTO_MUTEX *ossl_quic_port_get0_mutex(QUIC_PORT *port);
/* Gets the current time. */
OSSL_TIME ossl_quic_port_get_time(QUIC_PORT *port);
# endif
#endif

View File

@ -692,7 +692,7 @@ QUIC_PORT *ossl_quic_channel_get0_port(QUIC_CHANNEL *ch)
CRYPTO_MUTEX *ossl_quic_channel_get_mutex(QUIC_CHANNEL *ch)
{
return ch->port->mutex;
return ossl_quic_port_get0_mutex(ch->port);
}
int ossl_quic_channel_has_pending(const QUIC_CHANNEL *ch)
@ -711,10 +711,7 @@ static OSSL_TIME get_time(void *arg)
{
QUIC_CHANNEL *ch = arg;
if (ch->port->now_cb == NULL)
return ossl_time_now();
return ch->port->now_cb(ch->port->now_cb_arg);
return ossl_quic_port_get_time(ch->port);
}
/* Used by QSM. */

View File

@ -101,16 +101,20 @@ CRYPTO_MUTEX *ossl_quic_port_get0_mutex(QUIC_PORT *port)
return port->mutex;
}
static OSSL_TIME get_time(void *arg)
OSSL_TIME ossl_quic_port_get_time(QUIC_PORT *port)
{
QUIC_PORT *port = arg;
if (port->now_cb == NULL)
return ossl_time_now();
return port->now_cb(port->now_cb_arg);
}
static OSSL_TIME get_time(void *port)
{
return ossl_quic_port_get_time(port);
}
/*
* QUIC Port: Network BIO Configuration
* ====================================