diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2019-12-02 16:51:17 +0100 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2019-12-04 14:34:24 +0000 |
commit | 2f566c23fbac5c36cf95db8c0f738abbd3b5555c (patch) | |
tree | d93dc9042a9ed09e5dbf488ba5b5f4c06e8970ab /src/plugins | |
parent | 65f6cfcdbcd88b53350df8285dca04fbd205cfaf (diff) |
quic: add conn-timeout config option
Type: feature
Change-Id: Ia9cb57b9f7c2d14a137556d6918763f1cb11850d
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/quic/quic.c | 18 | ||||
-rw-r--r-- | src/plugins/quic/quic.h | 2 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c index 6b9f1e1d1e4..983358ea852 100644 --- a/src/plugins/quic/quic.c +++ b/src/plugins/quic/quic.c @@ -101,6 +101,7 @@ quic_store_quicly_ctx (application_t * app, u32 ckpair_index, quicly_ctx->transport_params.max_data = QUIC_INT_MAX; quicly_ctx->transport_params.max_streams_uni = (uint64_t) 1 << 60; quicly_ctx->transport_params.max_streams_bidi = (uint64_t) 1 << 60; + quicly_ctx->transport_params.idle_timeout = qm->connection_timeout; /* max_enq is FIFO_SIZE - 1 */ max_enq = app->sm_properties.rx_fifo_size - 1; @@ -141,7 +142,6 @@ error: return VNET_API_ERROR_MISSING_CERT_KEY; } - /* Helper functions */ static u32 @@ -1706,7 +1706,6 @@ tx_end: return 0; } - /* * Returns 0 if a matching connection is found and is on the right thread. * Otherwise returns -1. @@ -2360,24 +2359,27 @@ quic_config_fn (vlib_main_t * vm, unformat_input_t * input) { quic_main_t *qm = &quic_main; uword tmp; + u32 i; qm->udp_fifo_size = QUIC_DEFAULT_FIFO_SIZE; qm->udp_fifo_prealloc = 0; + qm->connection_timeout = QUIC_DEFAULT_CONN_TIMEOUT; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "fifo-size %U", unformat_memory_size, &tmp)) { if (tmp >= 0x100000000ULL) { - return clib_error_return - (0, "fifo-size %llu (0x%llx) too large", tmp, tmp); + return clib_error_return (0, + "fifo-size %llu (0x%llx) too large", + tmp, tmp); } qm->udp_fifo_size = tmp; } - else - if (unformat - (input, "fifo-prealloc %u", &quic_main.udp_fifo_prealloc)) - ; + else if (unformat (input, "conn-timeout %u", &i)) + qm->connection_timeout = i; + else if (unformat (input, "fifo-prealloc %u", &i)) + qm->udp_fifo_prealloc = i; else return clib_error_return (0, "unknown input '%U'", format_unformat_error, input); diff --git a/src/plugins/quic/quic.h b/src/plugins/quic/quic.h index 56817bc0352..dfcb0e6f17a 100644 --- a/src/plugins/quic/quic.h +++ b/src/plugins/quic/quic.h @@ -43,6 +43,7 @@ #define QUIC_SEND_MAX_BATCH_PACKETS 16 #define QUIC_RCV_MAX_BATCH_PACKETS 16 +#define QUIC_DEFAULT_CONN_TIMEOUT (30 * 1000) /* 30 seconds */ /* Taken from quicly.c */ #define QUICLY_QUIC_BIT 0x40 @@ -216,6 +217,7 @@ typedef struct quic_main_ u32 udp_fifo_size; u32 udp_fifo_prealloc; + u32 connection_timeout; } quic_main_t; #endif /* __included_quic_h__ */ |