mirror of
https://github.com/openssl/openssl.git
synced 2025-01-06 13:26:43 +08:00
QUIC PORT: Keep a list of all child channels
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:
parent
f98bc5c95b
commit
ce503f5c85
@ -46,6 +46,8 @@
|
|||||||
*/
|
*/
|
||||||
#define DEFAULT_MAX_ACK_DELAY QUIC_DEFAULT_MAX_ACK_DELAY
|
#define DEFAULT_MAX_ACK_DELAY QUIC_DEFAULT_MAX_ACK_DELAY
|
||||||
|
|
||||||
|
DEFINE_LIST_OF_IMPL(ch, QUIC_CHANNEL);
|
||||||
|
|
||||||
static void ch_save_err_state(QUIC_CHANNEL *ch);
|
static void ch_save_err_state(QUIC_CHANNEL *ch);
|
||||||
static void ch_rx_pre(QUIC_CHANNEL *ch);
|
static void ch_rx_pre(QUIC_CHANNEL *ch);
|
||||||
static int ch_rx(QUIC_CHANNEL *ch, int channel_only);
|
static int ch_rx(QUIC_CHANNEL *ch, int channel_only);
|
||||||
@ -486,6 +488,8 @@ static int ch_init(QUIC_CHANNEL *ch)
|
|||||||
ch_update_idle(ch);
|
ch_update_idle(ch);
|
||||||
ossl_quic_reactor_init(&ch->rtor, ch_tick, ch,
|
ossl_quic_reactor_init(&ch->rtor, ch_tick, ch,
|
||||||
ch_determine_next_tick_deadline(ch));
|
ch_determine_next_tick_deadline(ch));
|
||||||
|
ossl_list_ch_insert_tail(&ch->port->channel_list, ch);
|
||||||
|
ch->on_port_list = 1;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@ -543,6 +547,10 @@ static void ch_cleanup(QUIC_CHANNEL *ch)
|
|||||||
OPENSSL_free(srte);
|
OPENSSL_free(srte);
|
||||||
}
|
}
|
||||||
lh_QUIC_SRT_ELEM_free(ch->srt_hash_tok);
|
lh_QUIC_SRT_ELEM_free(ch->srt_hash_tok);
|
||||||
|
if (ch->on_port_list) {
|
||||||
|
ossl_list_ch_remove(&ch->port->channel_list, ch);
|
||||||
|
ch->on_port_list = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QUIC_CHANNEL *ossl_quic_channel_new(const QUIC_CHANNEL_ARGS *args)
|
QUIC_CHANNEL *ossl_quic_channel_new(const QUIC_CHANNEL_ARGS *args)
|
||||||
|
@ -38,6 +38,12 @@ DEFINE_LIST_OF(stateless_reset_tokens, QUIC_SRT_ELEM);
|
|||||||
struct quic_channel_st {
|
struct quic_channel_st {
|
||||||
QUIC_PORT *port;
|
QUIC_PORT *port;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* QUIC_PORT keeps the channels which belong to it on a list for bookkeeping
|
||||||
|
* purposes.
|
||||||
|
*/
|
||||||
|
OSSL_LIST_MEMBER(ch, struct quic_channel_st);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The associated TLS 1.3 connection data. Used to provide the handshake
|
* The associated TLS 1.3 connection data. Used to provide the handshake
|
||||||
* layer; its 'network' side is plugged into the crypto stream for each EL
|
* layer; its 'network' side is plugged into the crypto stream for each EL
|
||||||
@ -449,6 +455,9 @@ struct quic_channel_st {
|
|||||||
/* Are we using addressed mode? */
|
/* Are we using addressed mode? */
|
||||||
unsigned int addressed_mode : 1;
|
unsigned int addressed_mode : 1;
|
||||||
|
|
||||||
|
/* Are we on the QUIC_PORT linked list of channels? */
|
||||||
|
unsigned int on_port_list : 1;
|
||||||
|
|
||||||
/* Saved error stack in case permanent error was encountered */
|
/* Saved error stack in case permanent error was encountered */
|
||||||
ERR_STATE *err_state;
|
ERR_STATE *err_state;
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ static OSSL_TIME get_time(void *arg);
|
|||||||
static void port_tick(QUIC_TICK_RESULT *res, void *arg, uint32_t flags);
|
static void port_tick(QUIC_TICK_RESULT *res, void *arg, uint32_t flags);
|
||||||
//static void port_default_packet_handler(QUIC_URXE *e, void *arg);
|
//static void port_default_packet_handler(QUIC_URXE *e, void *arg);
|
||||||
|
|
||||||
|
DEFINE_LIST_OF_IMPL(ch, QUIC_CHANNEL);
|
||||||
|
|
||||||
QUIC_PORT *ossl_quic_port_new(const QUIC_PORT_ARGS *args)
|
QUIC_PORT *ossl_quic_port_new(const QUIC_PORT_ARGS *args)
|
||||||
{
|
{
|
||||||
QUIC_PORT *port;
|
QUIC_PORT *port;
|
||||||
@ -82,6 +84,7 @@ err:
|
|||||||
|
|
||||||
static void port_cleanup(QUIC_PORT *port)
|
static void port_cleanup(QUIC_PORT *port)
|
||||||
{
|
{
|
||||||
|
assert(ossl_list_ch_num(&port->channel_list) == 0);
|
||||||
ossl_quic_demux_free(port->demux);
|
ossl_quic_demux_free(port->demux);
|
||||||
port->demux = NULL;
|
port->demux = NULL;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
# include "internal/quic_port.h"
|
# include "internal/quic_port.h"
|
||||||
# include "internal/quic_reactor.h"
|
# include "internal/quic_reactor.h"
|
||||||
|
# include "internal/list.h"
|
||||||
|
|
||||||
# ifndef OPENSSL_NO_QUIC
|
# ifndef OPENSSL_NO_QUIC
|
||||||
|
|
||||||
@ -15,6 +16,8 @@
|
|||||||
*
|
*
|
||||||
* Other components should not include this header.
|
* Other components should not include this header.
|
||||||
*/
|
*/
|
||||||
|
DECLARE_LIST_OF(ch, QUIC_CHANNEL);
|
||||||
|
|
||||||
struct quic_port_st {
|
struct quic_port_st {
|
||||||
OSSL_LIB_CTX *libctx;
|
OSSL_LIB_CTX *libctx;
|
||||||
const char *propq;
|
const char *propq;
|
||||||
@ -39,6 +42,9 @@ struct quic_port_st {
|
|||||||
|
|
||||||
/* RX demuxer. We register incoming DCIDs with this. */
|
/* RX demuxer. We register incoming DCIDs with this. */
|
||||||
QUIC_DEMUX *demux;
|
QUIC_DEMUX *demux;
|
||||||
|
|
||||||
|
/* List of all child channels. */
|
||||||
|
OSSL_LIST(ch) channel_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
Loading…
Reference in New Issue
Block a user