summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Salzman <daniel.salzman@nic.cz>2023-08-24 17:35:11 +0200
committerDaniel Salzman <daniel.salzman@nic.cz>2023-08-24 17:35:11 +0200
commit5887112b822c803b23ec81f66b71c66093cc4ff2 (patch)
tree302e927395c5ead4a82eb08045907ff10344b319
parentutils: fix array length value (Coverity) (diff)
parentquic: remove unnecessary argument (diff)
downloadknot-5887112b822c803b23ec81f66b71c66093cc4ff2.tar.xz
knot-5887112b822c803b23ec81f66b71c66093cc4ff2.zip
Merge branch 'qlog_null_optimize' into 'master'
Qlog null optimize See merge request knot/knot-dns!1572
-rw-r--r--src/libknot/quic/quic.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/libknot/quic/quic.c b/src/libknot/quic/quic.c
index 1083de54c..2d871c724 100644
--- a/src/libknot/quic/quic.c
+++ b/src/libknot/quic/quic.c
@@ -759,9 +759,11 @@ static void user_qlog(void *user_data, uint32_t flags, const void *data, size_t
static int conn_new(ngtcp2_conn **pconn, const ngtcp2_path *path, const ngtcp2_cid *scid,
const ngtcp2_cid *dcid, const ngtcp2_cid *odcid, uint32_t version,
- uint64_t now, size_t udp_pl, uint64_t idle_timeout_ns,
- void *user_data, bool server, bool retry_sent)
+ uint64_t now, uint64_t idle_timeout_ns,
+ knot_quic_conn_t *qconn, bool server, bool retry_sent)
{
+ knot_quic_table_t *qtable = qconn->quic_table;
+
// I. CALLBACKS
const ngtcp2_callbacks callbacks = {
ngtcp2_crypto_client_initial_cb,
@@ -809,10 +811,14 @@ static int conn_new(ngtcp2_conn **pconn, const ngtcp2_path *path, const ngtcp2_c
ngtcp2_settings settings;
ngtcp2_settings_default(&settings);
settings.initial_ts = now;
- settings.log_printf = user_printf;
- settings.qlog_write = user_qlog;
- if (udp_pl != 0) {
- settings.max_tx_udp_payload_size = udp_pl;
+ if (qtable->log_cb != NULL) {
+ settings.log_printf = user_printf;
+ }
+ if (qtable->qlog_dir != NULL) {
+ settings.qlog_write = user_qlog;
+ }
+ if (qtable->udp_payload_limit != 0) {
+ settings.max_tx_udp_payload_size = qtable->udp_payload_limit;
}
settings.handshake_timeout = idle_timeout_ns; // NOTE setting handshake timeout to idle_timeout for simplicity
@@ -847,10 +853,10 @@ static int conn_new(ngtcp2_conn **pconn, const ngtcp2_path *path, const ngtcp2_c
if (server) {
return ngtcp2_conn_server_new(pconn, dcid, scid, path, version, &callbacks,
- &settings, &params, NULL, user_data);
+ &settings, &params, NULL, qconn);
} else {
return ngtcp2_conn_client_new(pconn, dcid, scid, path, version, &callbacks,
- &settings, &params, NULL, user_data);
+ &settings, &params, NULL, qconn);
}
}
@@ -878,7 +884,7 @@ int knot_quic_client(knot_quic_table_t *table, struct sockaddr_in6 *dest,
path.local.addrlen = addr_len((const struct sockaddr_in6 *)via);
int ret = conn_new(&conn->conn, &path, &dcid, &scid, NULL, NGTCP2_PROTO_VER_V1, now,
- table->udp_payload_limit, 5000000000L, conn, false, false);
+ 5000000000L, conn, false, false);
if (ret == KNOT_EOK) {
ret = tls_init_conn_session(conn, false);
}
@@ -982,8 +988,7 @@ int knot_quic_handle(knot_quic_table_t *table, knot_quic_reply_t *reply,
quic_conn_mark_used(conn, table, now);
ret = conn_new(&conn->conn, &path, &dcid, &scid, &odcid, decoded_cids.version,
- now, table->udp_payload_limit, idle_timeout, conn, true,
- header.tokenlen > 0);
+ now, idle_timeout, conn, true, header.tokenlen > 0);
if (ret >= 0) {
ret = tls_init_conn_session(conn, true);
}