summaryrefslogtreecommitdiffstats
path: root/contrib/libs/ngtcp2
diff options
context:
space:
mode:
authorYDBot <[email protected]>2025-10-23 18:38:13 +0000
committerYDBot <[email protected]>2025-10-23 18:38:13 +0000
commit564cf7cb2255a107b4f44c18b2a1844041f20b4d (patch)
tree6a4a60e8bde612dcc3ac7fd93fffbd36351d4e35 /contrib/libs/ngtcp2
parent89a17b25091c24744b7ebd0650b5b810457b1145 (diff)
parenta703d86902fd02bd8e373d959b2498c034657449 (diff)
Merge pull request #27203 from ydb-platform/merge-rightlib-251021-0051HEADmain
Diffstat (limited to 'contrib/libs/ngtcp2')
-rw-r--r--contrib/libs/ngtcp2/.yandex_meta/devtools.copyrights.report2
-rw-r--r--contrib/libs/ngtcp2/.yandex_meta/devtools.licenses.report4
-rw-r--r--contrib/libs/ngtcp2/.yandex_meta/licenses.list.txt1
-rw-r--r--contrib/libs/ngtcp2/.yandex_meta/override.nix4
-rw-r--r--contrib/libs/ngtcp2/AUTHORS1
-rw-r--r--contrib/libs/ngtcp2/README.rst8
-rw-r--r--contrib/libs/ngtcp2/crypto/boringssl/.yandex_meta/licenses.list.txt1
-rw-r--r--contrib/libs/ngtcp2/crypto/boringssl/ya.make2
-rw-r--r--contrib/libs/ngtcp2/crypto/quictls/.yandex_meta/licenses.list.txt1
-rw-r--r--contrib/libs/ngtcp2/crypto/quictls/ya.make2
-rw-r--r--contrib/libs/ngtcp2/lib/includes/ngtcp2/ngtcp2.h59
-rw-r--r--contrib/libs/ngtcp2/lib/includes/ngtcp2/version.h4
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_bbr.c9
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_cc.c42
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_conn.c173
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_conn.h4
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_conn_info.c50
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_conn_info.h45
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_conn_stat.h39
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_log.c489
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_log.h65
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_qlog.c22
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_range.c4
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_ratelim.c21
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_ratelim.h2
-rw-r--r--contrib/libs/ngtcp2/lib/ngtcp2_rtb.c61
-rw-r--r--contrib/libs/ngtcp2/ya.make5
27 files changed, 677 insertions, 443 deletions
diff --git a/contrib/libs/ngtcp2/.yandex_meta/devtools.copyrights.report b/contrib/libs/ngtcp2/.yandex_meta/devtools.copyrights.report
index ebb133dd1d5..5de83703fef 100644
--- a/contrib/libs/ngtcp2/.yandex_meta/devtools.copyrights.report
+++ b/contrib/libs/ngtcp2/.yandex_meta/devtools.copyrights.report
@@ -255,6 +255,8 @@ BELONGS ya.make
Files with this license:
lib/ngtcp2_callbacks.c [4:4]
lib/ngtcp2_callbacks.h [4:4]
+ lib/ngtcp2_conn_info.c [4:4]
+ lib/ngtcp2_conn_info.h [4:4]
lib/ngtcp2_dcidtr.c [4:4]
lib/ngtcp2_dcidtr.h [4:4]
lib/ngtcp2_pcg.c [4:4]
diff --git a/contrib/libs/ngtcp2/.yandex_meta/devtools.licenses.report b/contrib/libs/ngtcp2/.yandex_meta/devtools.licenses.report
index 0c8af1dfcc2..cd51435125c 100644
--- a/contrib/libs/ngtcp2/.yandex_meta/devtools.licenses.report
+++ b/contrib/libs/ngtcp2/.yandex_meta/devtools.licenses.report
@@ -116,7 +116,7 @@ BELONGS ya.make
KEEP MIT a3a8f7feced3937b87cd090ba748e24b
BELONGS crypto/boringssl/ya.make crypto/quictls/ya.make ya.make
-FILE_INCLUDE AUTHORS found in files: crypto/boringssl/boringssl.c at line 20, crypto/includes/ngtcp2/ngtcp2_crypto.h at line 20, crypto/includes/ngtcp2/ngtcp2_crypto_boringssl.h at line 20, crypto/includes/ngtcp2/ngtcp2_crypto_quictls.h at line 20, crypto/quictls/quictls.c at line 20, crypto/shared.c at line 20, crypto/shared.h at line 20, lib/includes/ngtcp2/ngtcp2.h at line 21, lib/includes/ngtcp2/version.h at line 20, lib/ngtcp2_acktr.c at line 20, lib/ngtcp2_acktr.h at line 20, lib/ngtcp2_addr.c at line 20, lib/ngtcp2_addr.h at line 20, lib/ngtcp2_balloc.c at line 20, lib/ngtcp2_balloc.h at line 20, lib/ngtcp2_bbr.c at line 20, lib/ngtcp2_bbr.h at line 20, lib/ngtcp2_buf.c at line 20, lib/ngtcp2_buf.h at line 20, lib/ngtcp2_callbacks.c at line 20, lib/ngtcp2_callbacks.h at line 20, lib/ngtcp2_cc.c at line 20, lib/ngtcp2_cc.h at line 20, lib/ngtcp2_cid.c at line 20, lib/ngtcp2_cid.h at line 20, lib/ngtcp2_conn.c at line 20, lib/ngtcp2_conn.h at line 20, lib/ngtcp2_conn_stat.h at line 20, lib/ngtcp2_conv.c at line 20, lib/ngtcp2_conv.h at line 20, lib/ngtcp2_crypto.c at line 20, lib/ngtcp2_crypto.h at line 20, lib/ngtcp2_dcidtr.c at line 20, lib/ngtcp2_dcidtr.h at line 20, lib/ngtcp2_err.c at line 20, lib/ngtcp2_err.h at line 20, lib/ngtcp2_frame_chain.c at line 20, lib/ngtcp2_frame_chain.h at line 20, lib/ngtcp2_gaptr.c at line 20, lib/ngtcp2_gaptr.h at line 20, lib/ngtcp2_idtr.c at line 20, lib/ngtcp2_idtr.h at line 20, lib/ngtcp2_ksl.c at line 20, lib/ngtcp2_ksl.h at line 20, lib/ngtcp2_log.c at line 20, lib/ngtcp2_log.h at line 20, lib/ngtcp2_macro.h at line 20, lib/ngtcp2_map.c at line 21, lib/ngtcp2_map.h at line 21, lib/ngtcp2_mem.c at line 21, lib/ngtcp2_mem.h at line 21, lib/ngtcp2_net.h at line 20, lib/ngtcp2_objalloc.c at line 20, lib/ngtcp2_objalloc.h at line 20, lib/ngtcp2_opl.c at line 20, lib/ngtcp2_opl.h at line 20, lib/ngtcp2_path.c at line 20, lib/ngtcp2_path.h at line 20, lib/ngtcp2_pcg.c at line 20, lib/ngtcp2_pcg.h at line 20, lib/ngtcp2_pkt.c at line 20, lib/ngtcp2_pkt.h at line 20, lib/ngtcp2_pktns_id.h at line 20, lib/ngtcp2_pmtud.c at line 20, lib/ngtcp2_pmtud.h at line 20, lib/ngtcp2_ppe.c at line 20, lib/ngtcp2_ppe.h at line 20, lib/ngtcp2_pq.c at line 21, lib/ngtcp2_pq.h at line 21, lib/ngtcp2_pv.c at line 20, lib/ngtcp2_pv.h at line 20, lib/ngtcp2_qlog.c at line 20, lib/ngtcp2_qlog.h at line 20, lib/ngtcp2_range.c at line 20, lib/ngtcp2_range.h at line 20, lib/ngtcp2_ratelim.c at line 21, lib/ngtcp2_ratelim.h at line 21, lib/ngtcp2_rcvry.h at line 20, lib/ngtcp2_ringbuf.c at line 20, lib/ngtcp2_ringbuf.h at line 20, lib/ngtcp2_rob.c at line 20, lib/ngtcp2_rob.h at line 20, lib/ngtcp2_rst.c at line 20, lib/ngtcp2_rst.h at line 20, lib/ngtcp2_rtb.c at line 20, lib/ngtcp2_rtb.h at line 20, lib/ngtcp2_settings.c at line 20, lib/ngtcp2_settings.h at line 20, lib/ngtcp2_str.c at line 20, lib/ngtcp2_str.h at line 20, lib/ngtcp2_strm.c at line 20, lib/ngtcp2_strm.h at line 20, lib/ngtcp2_transport_params.c at line 20, lib/ngtcp2_transport_params.h at line 20, lib/ngtcp2_tstamp.h at line 20, lib/ngtcp2_unreachable.c at line 20, lib/ngtcp2_unreachable.h at line 20, lib/ngtcp2_vec.c at line 20, lib/ngtcp2_vec.h at line 20, lib/ngtcp2_version.c at line 20, lib/ngtcp2_window_filter.c at line 20, lib/ngtcp2_window_filter.h at line 20
+FILE_INCLUDE AUTHORS found in files: crypto/boringssl/boringssl.c at line 20, crypto/includes/ngtcp2/ngtcp2_crypto.h at line 20, crypto/includes/ngtcp2/ngtcp2_crypto_boringssl.h at line 20, crypto/includes/ngtcp2/ngtcp2_crypto_quictls.h at line 20, crypto/quictls/quictls.c at line 20, crypto/shared.c at line 20, crypto/shared.h at line 20, lib/includes/ngtcp2/ngtcp2.h at line 21, lib/includes/ngtcp2/version.h at line 20, lib/ngtcp2_acktr.c at line 20, lib/ngtcp2_acktr.h at line 20, lib/ngtcp2_addr.c at line 20, lib/ngtcp2_addr.h at line 20, lib/ngtcp2_balloc.c at line 20, lib/ngtcp2_balloc.h at line 20, lib/ngtcp2_bbr.c at line 20, lib/ngtcp2_bbr.h at line 20, lib/ngtcp2_buf.c at line 20, lib/ngtcp2_buf.h at line 20, lib/ngtcp2_callbacks.c at line 20, lib/ngtcp2_callbacks.h at line 20, lib/ngtcp2_cc.c at line 20, lib/ngtcp2_cc.h at line 20, lib/ngtcp2_cid.c at line 20, lib/ngtcp2_cid.h at line 20, lib/ngtcp2_conn.c at line 20, lib/ngtcp2_conn.h at line 20, lib/ngtcp2_conn_info.c at line 20, lib/ngtcp2_conn_info.h at line 20, lib/ngtcp2_conn_stat.h at line 20, lib/ngtcp2_conv.c at line 20, lib/ngtcp2_conv.h at line 20, lib/ngtcp2_crypto.c at line 20, lib/ngtcp2_crypto.h at line 20, lib/ngtcp2_dcidtr.c at line 20, lib/ngtcp2_dcidtr.h at line 20, lib/ngtcp2_err.c at line 20, lib/ngtcp2_err.h at line 20, lib/ngtcp2_frame_chain.c at line 20, lib/ngtcp2_frame_chain.h at line 20, lib/ngtcp2_gaptr.c at line 20, lib/ngtcp2_gaptr.h at line 20, lib/ngtcp2_idtr.c at line 20, lib/ngtcp2_idtr.h at line 20, lib/ngtcp2_ksl.c at line 20, lib/ngtcp2_ksl.h at line 20, lib/ngtcp2_log.c at line 20, lib/ngtcp2_log.h at line 20, lib/ngtcp2_macro.h at line 20, lib/ngtcp2_map.c at line 21, lib/ngtcp2_map.h at line 21, lib/ngtcp2_mem.c at line 21, lib/ngtcp2_mem.h at line 21, lib/ngtcp2_net.h at line 20, lib/ngtcp2_objalloc.c at line 20, lib/ngtcp2_objalloc.h at line 20, lib/ngtcp2_opl.c at line 20, lib/ngtcp2_opl.h at line 20, lib/ngtcp2_path.c at line 20, lib/ngtcp2_path.h at line 20, lib/ngtcp2_pcg.c at line 20, lib/ngtcp2_pcg.h at line 20, lib/ngtcp2_pkt.c at line 20, lib/ngtcp2_pkt.h at line 20, lib/ngtcp2_pktns_id.h at line 20, lib/ngtcp2_pmtud.c at line 20, lib/ngtcp2_pmtud.h at line 20, lib/ngtcp2_ppe.c at line 20, lib/ngtcp2_ppe.h at line 20, lib/ngtcp2_pq.c at line 21, lib/ngtcp2_pq.h at line 21, lib/ngtcp2_pv.c at line 20, lib/ngtcp2_pv.h at line 20, lib/ngtcp2_qlog.c at line 20, lib/ngtcp2_qlog.h at line 20, lib/ngtcp2_range.c at line 20, lib/ngtcp2_range.h at line 20, lib/ngtcp2_ratelim.c at line 21, lib/ngtcp2_ratelim.h at line 21, lib/ngtcp2_rcvry.h at line 20, lib/ngtcp2_ringbuf.c at line 20, lib/ngtcp2_ringbuf.h at line 20, lib/ngtcp2_rob.c at line 20, lib/ngtcp2_rob.h at line 20, lib/ngtcp2_rst.c at line 20, lib/ngtcp2_rst.h at line 20, lib/ngtcp2_rtb.c at line 20, lib/ngtcp2_rtb.h at line 20, lib/ngtcp2_settings.c at line 20, lib/ngtcp2_settings.h at line 20, lib/ngtcp2_str.c at line 20, lib/ngtcp2_str.h at line 20, lib/ngtcp2_strm.c at line 20, lib/ngtcp2_strm.h at line 20, lib/ngtcp2_transport_params.c at line 20, lib/ngtcp2_transport_params.h at line 20, lib/ngtcp2_tstamp.h at line 20, lib/ngtcp2_unreachable.c at line 20, lib/ngtcp2_unreachable.h at line 20, lib/ngtcp2_vec.c at line 20, lib/ngtcp2_vec.h at line 20, lib/ngtcp2_version.c at line 20, lib/ngtcp2_window_filter.c at line 20, lib/ngtcp2_window_filter.h at line 20
Note: matched license text is too long. Read it in the source files.
Scancode info:
Original SPDX id: MIT
@@ -151,6 +151,8 @@ FILE_INCLUDE AUTHORS found in files: crypto/boringssl/boringssl.c at line 20, cr
lib/ngtcp2_cid.h [6:23]
lib/ngtcp2_conn.c [6:23]
lib/ngtcp2_conn.h [6:23]
+ lib/ngtcp2_conn_info.c [6:23]
+ lib/ngtcp2_conn_info.h [6:23]
lib/ngtcp2_conn_stat.h [6:23]
lib/ngtcp2_conv.c [6:23]
lib/ngtcp2_conv.h [6:23]
diff --git a/contrib/libs/ngtcp2/.yandex_meta/licenses.list.txt b/contrib/libs/ngtcp2/.yandex_meta/licenses.list.txt
index 56673420b33..5dfdfa781b3 100644
--- a/contrib/libs/ngtcp2/.yandex_meta/licenses.list.txt
+++ b/contrib/libs/ngtcp2/.yandex_meta/licenses.list.txt
@@ -135,6 +135,7 @@ Marin Rukavina
Mark Chiou
Martin Thomson
Michael White
+Mike L.
Moritz Buhl
NKTelnet
Natris
diff --git a/contrib/libs/ngtcp2/.yandex_meta/override.nix b/contrib/libs/ngtcp2/.yandex_meta/override.nix
index 6b5bf9737e2..1682578e20c 100644
--- a/contrib/libs/ngtcp2/.yandex_meta/override.nix
+++ b/contrib/libs/ngtcp2/.yandex_meta/override.nix
@@ -1,9 +1,9 @@
pkgs: attrs: with pkgs; rec {
- version = "1.15.1";
+ version = "1.16.0";
src = fetchurl {
url = "https://github.com/ngtcp2/ngtcp2/releases/download/v${version}/ngtcp2-${version}.tar.xz";
- hash = "sha256-BvLux8p2VSBBBQRz2ZLTBjeC4m/f9XUzy4zYyaaFmhc=";
+ hash = "sha256-Nny87KylOfdkU8SUVNjns47LFirPic1XFTWsSs+CorQ=";
};
patches = [];
diff --git a/contrib/libs/ngtcp2/AUTHORS b/contrib/libs/ngtcp2/AUTHORS
index d09ff327be0..214e07037e9 100644
--- a/contrib/libs/ngtcp2/AUTHORS
+++ b/contrib/libs/ngtcp2/AUTHORS
@@ -37,6 +37,7 @@ Marin Rukavina
Mark Chiou
Martin Thomson
Michael White
+Mike L.
Moritz Buhl
NKTelnet
Natris
diff --git a/contrib/libs/ngtcp2/README.rst b/contrib/libs/ngtcp2/README.rst
index 64495b2827e..30306a2d0bb 100644
--- a/contrib/libs/ngtcp2/README.rst
+++ b/contrib/libs/ngtcp2/README.rst
@@ -61,9 +61,9 @@ directory require at least one of the following TLS backends:
- `quictls
<https://github.com/quictls/openssl/tree/OpenSSL_1_1_1w+quic>`_
- GnuTLS >= 3.7.5
-- BoringSSL (commit 729648fb79df7bc46c145e49b0dfd8d2a24232f1);
+- BoringSSL (commit fa47b1d0f9d3d30601d7e5ed158d3055cbe6ff44);
or aws-lc >= 1.39.0
-- Picotls (commit f350eab60742138ac62b42ee444adf04c7898b0d)
+- Picotls (commit 4e443c11eb48949e597911b1b772a9d2588b4769)
- wolfSSL >= 5.5.0
- LibreSSL >= v3.9.2
- OpenSSL >= 3.5.0 (experimental)
@@ -115,7 +115,7 @@ Build with BoringSSL
$ git clone https://boringssl.googlesource.com/boringssl
$ cd boringssl
- $ git checkout 729648fb79df7bc46c145e49b0dfd8d2a24232f1
+ $ git checkout fa47b1d0f9d3d30601d7e5ed158d3055cbe6ff44
$ cmake -B build -DCMAKE_POSITION_INDEPENDENT_CODE=ON
$ make -j$(nproc) -C build
$ cd ..
@@ -142,7 +142,7 @@ Build with aws-lc
.. code-block:: shell
- $ git clone --depth 1 -b v1.58.1 https://github.com/aws/aws-lc
+ $ git clone --depth 1 -b v1.61.2 https://github.com/aws/aws-lc
$ cd aws-lc
$ cmake -B build -DDISABLE_GO=ON
$ make -j$(nproc) -C build
diff --git a/contrib/libs/ngtcp2/crypto/boringssl/.yandex_meta/licenses.list.txt b/contrib/libs/ngtcp2/crypto/boringssl/.yandex_meta/licenses.list.txt
index 84f37b72207..e041fe202f3 100644
--- a/contrib/libs/ngtcp2/crypto/boringssl/.yandex_meta/licenses.list.txt
+++ b/contrib/libs/ngtcp2/crypto/boringssl/.yandex_meta/licenses.list.txt
@@ -42,6 +42,7 @@ Marin Rukavina
Mark Chiou
Martin Thomson
Michael White
+Mike L.
Moritz Buhl
NKTelnet
Natris
diff --git a/contrib/libs/ngtcp2/crypto/boringssl/ya.make b/contrib/libs/ngtcp2/crypto/boringssl/ya.make
index 023dd779c57..b16b9b6cc06 100644
--- a/contrib/libs/ngtcp2/crypto/boringssl/ya.make
+++ b/contrib/libs/ngtcp2/crypto/boringssl/ya.make
@@ -2,7 +2,7 @@
LIBRARY()
-VERSION(1.15.1)
+VERSION(1.16.0)
LICENSE(MIT)
diff --git a/contrib/libs/ngtcp2/crypto/quictls/.yandex_meta/licenses.list.txt b/contrib/libs/ngtcp2/crypto/quictls/.yandex_meta/licenses.list.txt
index 36ed6f02da2..dbfe8c101ca 100644
--- a/contrib/libs/ngtcp2/crypto/quictls/.yandex_meta/licenses.list.txt
+++ b/contrib/libs/ngtcp2/crypto/quictls/.yandex_meta/licenses.list.txt
@@ -42,6 +42,7 @@ Marin Rukavina
Mark Chiou
Martin Thomson
Michael White
+Mike L.
Moritz Buhl
NKTelnet
Natris
diff --git a/contrib/libs/ngtcp2/crypto/quictls/ya.make b/contrib/libs/ngtcp2/crypto/quictls/ya.make
index 97b50d7759c..fdaa1aef8b0 100644
--- a/contrib/libs/ngtcp2/crypto/quictls/ya.make
+++ b/contrib/libs/ngtcp2/crypto/quictls/ya.make
@@ -2,7 +2,7 @@
LIBRARY()
-VERSION(1.15.1)
+VERSION(1.16.0)
LICENSE(MIT)
diff --git a/contrib/libs/ngtcp2/lib/includes/ngtcp2/ngtcp2.h b/contrib/libs/ngtcp2/lib/includes/ngtcp2/ngtcp2.h
index 2201fcae0b2..23679da06d8 100644
--- a/contrib/libs/ngtcp2/lib/includes/ngtcp2/ngtcp2.h
+++ b/contrib/libs/ngtcp2/lib/includes/ngtcp2/ngtcp2.h
@@ -1561,7 +1561,8 @@ typedef struct ngtcp2_transport_params {
} ngtcp2_transport_params;
#define NGTCP2_CONN_INFO_V1 1
-#define NGTCP2_CONN_INFO_VERSION NGTCP2_CONN_INFO_V1
+#define NGTCP2_CONN_INFO_V2 2
+#define NGTCP2_CONN_INFO_VERSION NGTCP2_CONN_INFO_V2
/**
* @struct
@@ -1600,6 +1601,52 @@ typedef struct ngtcp2_conn_info {
* packets which have not been acknowledged.
*/
uint64_t bytes_in_flight;
+ /* The following fields have been added since NGTCP2_CONN_INFO_V2. */
+ /**
+ * :member:`pkt_sent` is the number of QUIC packets sent. This
+ * field has been available since v1.16.0.
+ */
+ uint64_t pkt_sent;
+ /**
+ * :member:`bytes_sent` is the number of bytes (the sum of QUIC
+ * packet length) sent. This field has been available since
+ * v1.16.0.
+ */
+ uint64_t bytes_sent;
+ /**
+ * :member:`pkt_recv` is the number of QUIC packets received,
+ * excluding discarded ones. This field has been available since
+ * v1.16.0.
+ */
+ uint64_t pkt_recv;
+ /**
+ * :member:`bytes_recv` is the number of bytes (the sum of QUIC
+ * packet length) received, excluding discarded ones. This field
+ * has been available since v1.16.0.
+ */
+ uint64_t bytes_recv;
+ /**
+ * :member:`pkt_lost` is the number of QUIC packets that are
+ * considered lost, excluding PMTUD packets. This field has been
+ * available since v1.16.0.
+ */
+ uint64_t pkt_lost;
+ /**
+ * :member:`bytes_lost` is the number of bytes (the sum of QUIC
+ * packet length) lost, excluding PMTUD packets. This field has
+ * been available since v1.16.0.
+ */
+ uint64_t bytes_lost;
+ /**
+ * :member:`ping_recv` is the number of PING frames received. This
+ * field has been available since v1.16.0.
+ */
+ uint64_t ping_recv;
+ /**
+ * :member:`pkt_discarded` is the number of QUIC packets discarded.
+ * This field has been available since v1.16.0.
+ */
+ uint64_t pkt_discarded;
} ngtcp2_conn_info;
/**
@@ -5689,6 +5736,16 @@ NGTCP2_EXTERN ngtcp2_ssize ngtcp2_conn_write_aggregate_pkt_versioned(
/**
* @function
*
+ * `ngtcp2_conn_get_timestamp` returns the latest timestamp that is
+ * known to |conn|.
+ *
+ * This function has been available since v1.16.0.
+ */
+NGTCP2_EXTERN ngtcp2_tstamp ngtcp2_conn_get_timestamp(const ngtcp2_conn *conn);
+
+/**
+ * @function
+ *
* `ngtcp2_strerror` returns the text representation of |liberr|.
* |liberr| must be one of ngtcp2 library error codes (which is
* defined as :macro:`NGTCP2_ERR_* <NGTCP2_ERR_INVALID_ARGUMENT>`
diff --git a/contrib/libs/ngtcp2/lib/includes/ngtcp2/version.h b/contrib/libs/ngtcp2/lib/includes/ngtcp2/version.h
index e70a095ceb1..9fabd7b1797 100644
--- a/contrib/libs/ngtcp2/lib/includes/ngtcp2/version.h
+++ b/contrib/libs/ngtcp2/lib/includes/ngtcp2/version.h
@@ -36,7 +36,7 @@
*
* Version number of the ngtcp2 library release.
*/
-#define NGTCP2_VERSION "1.15.1"
+#define NGTCP2_VERSION "1.16.0"
/**
* @macro
@@ -46,6 +46,6 @@
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
* becomes 0x010203.
*/
-#define NGTCP2_VERSION_NUM 0x010f01
+#define NGTCP2_VERSION_NUM 0x011000
#endif /* !defined(NGTCP2_VERSION_H) */
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_bbr.c b/contrib/libs/ngtcp2/lib/ngtcp2_bbr.c
index 44be1e189b8..2aa5d6fcadb 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_bbr.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_bbr.c
@@ -384,8 +384,9 @@ static void bbr_check_full_bw_reached(ngtcp2_cc_bbr *bbr,
bbr->full_bw_reached = 1;
- ngtcp2_log_info(bbr->cc.log, NGTCP2_LOG_EVENT_CCA,
- "bbr reached full bandwidth, full_bw=%" PRIu64, bbr->full_bw);
+ ngtcp2_log_infof(bbr->cc.log, NGTCP2_LOG_EVENT_CCA,
+ "bbr reached full bandwidth, full_bw=%" PRIu64,
+ bbr->full_bw);
}
static void bbr_check_startup_high_loss(ngtcp2_cc_bbr *bbr) {
@@ -1025,8 +1026,8 @@ static void bbr_update_min_rtt(ngtcp2_cc_bbr *bbr, const ngtcp2_cc_ack *ack,
bbr->min_rtt = bbr->probe_rtt_min_delay;
bbr->min_rtt_stamp = bbr->probe_rtt_min_stamp;
- ngtcp2_log_info(bbr->cc.log, NGTCP2_LOG_EVENT_CCA,
- "bbr update min_rtt=%" PRIu64, bbr->min_rtt);
+ ngtcp2_log_infof(bbr->cc.log, NGTCP2_LOG_EVENT_CCA,
+ "bbr update min_rtt=%" PRIu64, bbr->min_rtt);
}
}
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_cc.c b/contrib/libs/ngtcp2/lib/ngtcp2_cc.c
index c16953802af..3fffef54484 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_cc.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_cc.c
@@ -92,9 +92,9 @@ void ngtcp2_cc_reno_cc_on_pkt_acked(ngtcp2_cc *cc, ngtcp2_conn_stat *cstat,
if (cstat->cwnd < cstat->ssthresh) {
cstat->cwnd += pkt->pktlen;
- ngtcp2_log_info(reno->cc.log, NGTCP2_LOG_EVENT_CCA,
- "pkn=%" PRId64 " acked, slow start cwnd=%" PRIu64,
- pkt->pkt_num, cstat->cwnd);
+ ngtcp2_log_infof(reno->cc.log, NGTCP2_LOG_EVENT_CCA,
+ "pkn=%" PRId64 " acked, slow start cwnd=%" PRIu64,
+ pkt->pkt_num, cstat->cwnd);
return;
}
@@ -123,9 +123,9 @@ void ngtcp2_cc_reno_cc_congestion_event(ngtcp2_cc *cc, ngtcp2_conn_stat *cstat,
reno->pending_add = 0;
- ngtcp2_log_info(reno->cc.log, NGTCP2_LOG_EVENT_CCA,
- "reduce cwnd because of packet loss cwnd=%" PRIu64,
- cstat->cwnd);
+ ngtcp2_log_infof(reno->cc.log, NGTCP2_LOG_EVENT_CCA,
+ "reduce cwnd because of packet loss cwnd=%" PRIu64,
+ cstat->cwnd);
}
void ngtcp2_cc_reno_cc_on_persistent_congestion(ngtcp2_cc *cc,
@@ -291,9 +291,9 @@ void ngtcp2_cc_cubic_cc_on_ack_recv(ngtcp2_cc *cc, ngtcp2_conn_stat *cstat,
cstat->cwnd += ack->bytes_delivered;
}
- ngtcp2_log_info(cubic->cc.log, NGTCP2_LOG_EVENT_CCA,
- "%" PRIu64 " bytes acked, slow start cwnd=%" PRIu64,
- ack->bytes_delivered, cstat->cwnd);
+ ngtcp2_log_infof(cubic->cc.log, NGTCP2_LOG_EVENT_CCA,
+ "%" PRIu64 " bytes acked, slow start cwnd=%" PRIu64,
+ ack->bytes_delivered, cstat->cwnd);
}
if (round_start) {
@@ -398,11 +398,11 @@ void ngtcp2_cc_cubic_cc_on_ack_recv(ngtcp2_cc *cc, ngtcp2_conn_stat *cstat,
cstat->cwnd += m / cstat->cwnd;
}
- ngtcp2_log_info(cubic->cc.log, NGTCP2_LOG_EVENT_CCA,
- "%" PRIu64 " bytes acked, cubic-ca cwnd=%" PRIu64
- " k_m=%" PRIu64 " target=%" PRIu64 " w_est=%" PRIu64,
- ack->bytes_delivered, cstat->cwnd, cubic->current.k_m, target,
- cubic->current.w_est);
+ ngtcp2_log_infof(cubic->cc.log, NGTCP2_LOG_EVENT_CCA,
+ "%" PRIu64 " bytes acked, cubic-ca cwnd=%" PRIu64
+ " k_m=%" PRIu64 " target=%" PRIu64 " w_est=%" PRIu64,
+ ack->bytes_delivered, cstat->cwnd, cubic->current.k_m,
+ target, cubic->current.w_est);
}
void ngtcp2_cc_cubic_cc_congestion_event(ngtcp2_cc *cc, ngtcp2_conn_stat *cstat,
@@ -464,9 +464,9 @@ void ngtcp2_cc_cubic_cc_congestion_event(ngtcp2_cc *cc, ngtcp2_conn_stat *cstat,
cubic->current.k_m =
ngtcp2_cbrt((cwnd_delta << 30) * 10 / 4 / cstat->max_tx_udp_payload_size);
- ngtcp2_log_info(cubic->cc.log, NGTCP2_LOG_EVENT_CCA,
- "reduce cwnd because of packet loss cwnd=%" PRIu64,
- cstat->cwnd);
+ ngtcp2_log_infof(cubic->cc.log, NGTCP2_LOG_EVENT_CCA,
+ "reduce cwnd because of packet loss cwnd=%" PRIu64,
+ cstat->cwnd);
}
void ngtcp2_cc_cubic_cc_on_spurious_congestion(ngtcp2_cc *cc,
@@ -482,10 +482,10 @@ void ngtcp2_cc_cubic_cc_on_spurious_congestion(ngtcp2_cc *cc,
cstat->cwnd = cubic->undo.cwnd;
cstat->ssthresh = cubic->undo.ssthresh;
- ngtcp2_log_info(cubic->cc.log, NGTCP2_LOG_EVENT_CCA,
- "spurious congestion is detected and congestion state is "
- "restored cwnd=%" PRIu64,
- cstat->cwnd);
+ ngtcp2_log_infof(cubic->cc.log, NGTCP2_LOG_EVENT_CCA,
+ "spurious congestion is detected and congestion state is "
+ "restored cwnd=%" PRIu64,
+ cstat->cwnd);
}
cubic_vars_reset(&cubic->undo.v);
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_conn.c b/contrib/libs/ngtcp2/lib/ngtcp2_conn.c
index d97ba6a71b2..13938761dd8 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_conn.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_conn.c
@@ -42,6 +42,7 @@
#include "ngtcp2_callbacks.h"
#include "ngtcp2_tstamp.h"
#include "ngtcp2_frame_chain.h"
+#include "ngtcp2_conn_info.h"
/* NGTCP2_FLOW_WINDOW_RTT_FACTOR is the factor of RTT when flow
control window auto-tuning is triggered. */
@@ -1084,8 +1085,8 @@ static void conn_update_skip_pkt(ngtcp2_conn *conn, ngtcp2_pktns *pktns) {
pktns->tx.skip_pkt.next_pkt_num = pktns->tx.last_pkt_num + gap;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON, "next skip pkn=%" PRId64,
- pktns->tx.skip_pkt.next_pkt_num);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON, "next skip pkn=%" PRId64,
+ pktns->tx.skip_pkt.next_pkt_num);
}
static int conn_handle_skip_pkt(ngtcp2_conn *conn, ngtcp2_pktns *pktns,
@@ -1862,9 +1863,9 @@ static int conn_cwnd_is_zero(ngtcp2_conn *conn) {
uint64_t cwnd = conn->cstat.cwnd;
if (bytes_in_flight >= cwnd) {
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_LDC,
- "cwnd limited bytes_in_flight=%lu cwnd=%lu",
- bytes_in_flight, cwnd);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_LDC,
+ "cwnd limited bytes_in_flight=%lu cwnd=%lu",
+ bytes_in_flight, cwnd);
}
return bytes_in_flight >= cwnd;
@@ -2735,6 +2736,9 @@ conn_write_handshake_pkt(ngtcp2_conn *conn, ngtcp2_pkt_info *pi, uint8_t *dest,
conn->tx.pacing.pktlen += (size_t)spktlen;
+ ++conn->cstat.pkt_sent;
+ conn->cstat.bytes_sent += (uint64_t)spktlen;
+
ngtcp2_qlog_metrics_updated(&conn->qlog, &conn->cstat);
++pktns->tx.last_pkt_num;
@@ -4476,8 +4480,8 @@ static ngtcp2_ssize conn_write_pkt(ngtcp2_conn *conn, ngtcp2_pkt_info *pi,
(rtb_entry_flags & NGTCP2_RTB_ENTRY_FLAG_ACK_ELICITING)) {
--pktns->rtb.probe_pkt_left;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON, "probe pkt size=%td",
- nwrite);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON, "probe pkt size=%td",
+ nwrite);
}
conn_update_keep_alive_last_ts(conn, ts);
@@ -4486,6 +4490,9 @@ static ngtcp2_ssize conn_write_pkt(ngtcp2_conn *conn, ngtcp2_pkt_info *pi,
conn->tx.pacing.pktlen += (size_t)nwrite;
+ ++conn->cstat.pkt_sent;
+ conn->cstat.bytes_sent += (uint64_t)nwrite;
+
ngtcp2_qlog_metrics_updated(&conn->qlog, &conn->cstat);
++pktns->tx.last_pkt_num;
@@ -4669,8 +4676,8 @@ ngtcp2_ssize ngtcp2_conn_write_single_frame_pkt(
ngtcp2_path_eq(&conn->dcid.current.ps.path, path)) {
--pktns->rtb.probe_pkt_left;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON, "probe pkt size=%td",
- nwrite);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON, "probe pkt size=%td",
+ nwrite);
}
}
} else if (pi && conn->tx.ecn.state == NGTCP2_ECN_STATE_CAPABLE) {
@@ -4693,6 +4700,9 @@ ngtcp2_ssize ngtcp2_conn_write_single_frame_pkt(
conn->tx.pacing.pktlen += (size_t)nwrite;
}
+ ++conn->cstat.pkt_sent;
+ conn->cstat.bytes_sent += (uint64_t)nwrite;
+
ngtcp2_qlog_metrics_updated(&conn->qlog, &conn->cstat);
++pktns->tx.last_pkt_num;
@@ -4899,8 +4909,8 @@ static ngtcp2_ssize conn_write_pmtud_probe(ngtcp2_conn *conn,
return 0;
}
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON,
- "sending PMTUD probe packet len=%zu", probelen);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON,
+ "sending PMTUD probe packet len=%zu", probelen);
lfr.type = NGTCP2_FRAME_PING;
@@ -5399,8 +5409,8 @@ static int conn_on_retry(ngtcp2_conn *conn, const ngtcp2_pkt_hd *hd,
uint8_t cidbuf[sizeof(retry.odcid.data) * 2 + 1];
uint8_t *token;
- if (!in_pktns || conn->flags & NGTCP2_CONN_FLAG_RECV_RETRY) {
- return 0;
+ if (!in_pktns || (conn->flags & NGTCP2_CONN_FLAG_RECV_RETRY)) {
+ return NGTCP2_ERR_DISCARD_PKT;
}
in_rtb = &in_pktns->rtb;
@@ -5421,9 +5431,9 @@ static int conn_on_retry(ngtcp2_conn *conn, const ngtcp2_pkt_hd *hd,
return rv;
}
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_PKT, "odcid=0x%s",
- (const char *)ngtcp2_encode_hex(cidbuf, retry.odcid.data,
- retry.odcid.datalen));
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_PKT, "odcid=0x%s",
+ (const char *)ngtcp2_encode_hex(cidbuf, retry.odcid.data,
+ retry.odcid.datalen));
if (retry.tokenlen == 0) {
return NGTCP2_ERR_PROTO;
@@ -6383,8 +6393,8 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
return 0;
}
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON,
- "buffering 1RTT packet len=%zu", pktlen);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON,
+ "buffering 1RTT packet len=%zu", pktlen);
rv =
conn_buffer_pkt(conn, &conn->pktns, path, pi, pkt, pktlen, dgramlen, ts);
@@ -6531,8 +6541,8 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
}
/* Buffer re-ordered 0-RTT packet. */
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON,
- "buffering 0-RTT packet len=%zu", pktlen);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON,
+ "buffering 0-RTT packet len=%zu", pktlen);
rv = conn_buffer_pkt(conn, conn->in_pktns, path, pi, pkt, pktlen, dgramlen,
ts);
@@ -6554,10 +6564,10 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
if (conn->server) {
if (dgramlen < NGTCP2_MAX_UDP_PAYLOAD_SIZE) {
- ngtcp2_log_info(
+ ngtcp2_log_infof(
&conn->log, NGTCP2_LOG_EVENT_PKT,
"Initial packet was ignored because it is included in UDP datagram "
- "less than %zu bytes: %zu bytes",
+ "less than %d bytes: %zu bytes",
NGTCP2_MAX_UDP_PAYLOAD_SIZE, dgramlen);
return NGTCP2_ERR_DISCARD_PKT;
}
@@ -6637,8 +6647,8 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
"Handshake packet at this point is unexpected and discarded");
return (ngtcp2_ssize)pktlen;
}
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON,
- "buffering Handshake packet len=%zu", pktlen);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON,
+ "buffering Handshake packet len=%zu", pktlen);
rv = conn_buffer_pkt(conn, conn->hs_pktns, path, pi, pkt, pktlen,
dgramlen, ts);
@@ -6692,8 +6702,8 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
hd.pkt_num = ngtcp2_pkt_adjust_pkt_num(pktns->acktr.max_pkt_num, hd.pkt_num,
hd.pkt_numlen);
if (hd.pkt_num > NGTCP2_MAX_PKT_NUM) {
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_PKT,
- "pkn=%" PRId64 " is greater than maximum pkn", hd.pkt_num);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_PKT,
+ "pkn=%" PRId64 " is greater than maximum pkn", hd.pkt_num);
return NGTCP2_ERR_DISCARD_PKT;
}
@@ -6740,9 +6750,9 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
!conn->negotiated_version) {
conn->negotiated_version = hd.version;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON,
- "the negotiated version is 0x%08x",
- conn->negotiated_version);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON,
+ "the negotiated version is 0x%08x",
+ conn->negotiated_version);
}
payload = conn->crypto.decrypt_buf.base;
@@ -6845,9 +6855,9 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
ngtcp2_vec_len(fr->stream.data, fr->stream.datacnt)) {
conn->negotiated_version = hd.version;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON,
- "the negotiated version is 0x%08x",
- conn->negotiated_version);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON,
+ "the negotiated version is 0x%08x",
+ conn->negotiated_version);
}
rv = conn_recv_crypto(conn, encryption_level, crypto, &fr->stream, ts);
@@ -6863,6 +6873,7 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
}
break;
case NGTCP2_FRAME_PING:
+ ++conn->cstat.ping_recv;
require_ack = 1;
break;
default:
@@ -6956,6 +6967,8 @@ static ngtcp2_ssize conn_recv_handshake_cpkt(ngtcp2_conn *conn,
return nread;
}
+ ++conn->cstat.pkt_discarded;
+
/* If server discards first Initial, then drop connection
state. This is because SCID in packet might be corrupted
and the current connection state might wrongly discard
@@ -6973,11 +6986,15 @@ static ngtcp2_ssize conn_recv_handshake_cpkt(ngtcp2_conn *conn,
unrecoverable, therefore drop connection. */
return nread;
}
+
+ ++conn->cstat.pkt_discarded;
+
return (ngtcp2_ssize)dgramlen;
}
}
if (nread == NGTCP2_ERR_DISCARD_PKT) {
+ ++conn->cstat.pkt_discarded;
return (ngtcp2_ssize)dgramlen;
}
@@ -6993,8 +7010,11 @@ static ngtcp2_ssize conn_recv_handshake_cpkt(ngtcp2_conn *conn,
pkt += nread;
pktlen -= (size_t)nread;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_PKT,
- "read packet %td left %zu", nread, pktlen);
+ ++conn->cstat.pkt_recv;
+ conn->cstat.bytes_recv += (uint64_t)nread;
+
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_PKT,
+ "read packet %td left %zu", nread, pktlen);
}
return (ngtcp2_ssize)dgramlen;
@@ -9022,8 +9042,10 @@ conn_recv_delayed_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_pkt_info *pi,
return rv;
}
break;
- case NGTCP2_FRAME_CRYPTO:
case NGTCP2_FRAME_PING:
+ ++conn->cstat.ping_recv;
+ /* fall through */
+ case NGTCP2_FRAME_CRYPTO:
require_ack = 1;
break;
default:
@@ -9193,8 +9215,8 @@ static ngtcp2_ssize conn_recv_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
break;
default:
ngtcp2_log_rx_pkt_hd(&conn->log, &hd);
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_PKT,
- "packet type 0x%02x was ignored", hd.type);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_PKT,
+ "packet type 0x%02x was ignored", hd.type);
return (ngtcp2_ssize)pktlen;
}
} else {
@@ -9241,8 +9263,8 @@ static ngtcp2_ssize conn_recv_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
hd.pkt_num = ngtcp2_pkt_adjust_pkt_num(pktns->acktr.max_pkt_num, hd.pkt_num,
hd.pkt_numlen);
if (hd.pkt_num > NGTCP2_MAX_PKT_NUM) {
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_PKT,
- "pkn=%" PRId64 " is greater than maximum pkn", hd.pkt_num);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_PKT,
+ "pkn=%" PRId64 " is greater than maximum pkn", hd.pkt_num);
return NGTCP2_ERR_DISCARD_PKT;
}
@@ -9253,7 +9275,7 @@ static ngtcp2_ssize conn_recv_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
conn->rx.preferred_addr.pkt_num < hd.pkt_num &&
ngtcp2_sockaddr_eq((const ngtcp2_sockaddr *)&conn->hs_local_addr,
path->local.addr)) {
- ngtcp2_log_info(
+ ngtcp2_log_infof(
&conn->log, NGTCP2_LOG_EVENT_PKT,
"pkt=%" PRId64
" is discarded because it was received on handshake local "
@@ -9545,6 +9567,7 @@ static ngtcp2_ssize conn_recv_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
}
break;
case NGTCP2_FRAME_PING:
+ ++conn->cstat.ping_recv;
non_probing_pkt = 1;
break;
case NGTCP2_FRAME_PATH_CHALLENGE:
@@ -9743,6 +9766,7 @@ static int conn_process_buffered_protected_pkt(ngtcp2_conn *conn,
*ppc = next;
if (nread < 0) {
if (nread == NGTCP2_ERR_DISCARD_PKT) {
+ ++conn->cstat.pkt_discarded;
continue;
}
return (int)nread;
@@ -9777,6 +9801,7 @@ static int conn_process_buffered_handshake_pkt(ngtcp2_conn *conn,
*ppc = next;
if (nread < 0) {
if (nread == NGTCP2_ERR_DISCARD_PKT) {
+ ++conn->cstat.pkt_discarded;
continue;
}
return (int)nread;
@@ -9922,6 +9947,7 @@ static int conn_recv_cpkt(ngtcp2_conn *conn, const ngtcp2_path *path,
}
}
if (nread == NGTCP2_ERR_DISCARD_PKT) {
+ ++conn->cstat.pkt_discarded;
return 0;
}
return (int)nread;
@@ -9931,8 +9957,11 @@ static int conn_recv_cpkt(ngtcp2_conn *conn, const ngtcp2_path *path,
pkt += nread;
pktlen -= (size_t)nread;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_PKT,
- "read packet %td left %zu", nread, pktlen);
+ ++conn->cstat.pkt_recv;
+ conn->cstat.bytes_recv += (uint64_t)nread;
+
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_PKT,
+ "read packet %td left %zu", nread, pktlen);
}
return 0;
@@ -10104,9 +10133,9 @@ static ngtcp2_ssize conn_read_handshake(ngtcp2_conn *conn,
if ((size_t)nread < pktlen) {
/* We have 1RTT packet and application rx key, but the
handshake has not completed yet. */
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON,
- "buffering 1RTT packet len=%zu",
- pktlen - (size_t)nread);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON,
+ "buffering 1RTT packet len=%zu",
+ pktlen - (size_t)nread);
rv = conn_buffer_pkt(conn, &conn->pktns, path, pi, pkt + nread,
pktlen - (size_t)nread, pktlen, ts);
@@ -10185,8 +10214,8 @@ int ngtcp2_conn_read_pkt_versioned(ngtcp2_conn *conn, const ngtcp2_path *path,
conn_update_timestamp(conn, ts);
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON, "recv packet len=%zu",
- pktlen);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON, "recv packet len=%zu",
+ pktlen);
if (pktlen == 0) {
return 0;
@@ -10198,6 +10227,8 @@ int ngtcp2_conn_read_pkt_versioned(ngtcp2_conn *conn, const ngtcp2_path *path,
!ngtcp2_dcidtr_check_path_retired(&conn->dcid.dtr, path)) {
ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON,
"ignore packet from unknown path");
+ ++conn->cstat.pkt_discarded;
+
return 0;
}
@@ -11516,9 +11547,9 @@ int ngtcp2_conn_set_remote_transport_params(
conn->local.transport_params.version_info.chosen_version =
conn->negotiated_version;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON,
- "the negotiated version is 0x%08x",
- conn->negotiated_version);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON,
+ "the negotiated version is 0x%08x",
+ conn->negotiated_version);
} else {
rv = conn_client_validate_transport_params(conn, params);
if (rv != 0) {
@@ -12306,9 +12337,9 @@ ngtcp2_ssize ngtcp2_conn_write_vmsg(ngtcp2_conn *conn, ngtcp2_path *path,
}
if (conn->pktns.rtb.probe_pkt_left) {
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_CON,
- "transmit probe pkt left=%zu",
- conn->pktns.rtb.probe_pkt_left);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_CON,
+ "transmit probe pkt left=%zu",
+ conn->pktns.rtb.probe_pkt_left);
nwrite = conn_write_pkt(conn, pi, dest, destlen, (size_t)res, vmsg,
NGTCP2_PKT_1RTT, wflags, ts);
@@ -13011,7 +13042,7 @@ int ngtcp2_conn_update_rtt(ngtcp2_conn *conn, ngtcp2_duration rtt,
rtt < cstat->min_rtt + ack_delay) {
/* Ignore RTT sample if adjusting ack_delay causes the sample
less than min_rtt before handshake confirmation. */
- ngtcp2_log_info(
+ ngtcp2_log_infof(
&conn->log, NGTCP2_LOG_EVENT_LDC,
"ignore rtt sample because ack_delay is too large latest_rtt=%" PRIu64
" min_rtt=%" PRIu64 " ack_delay=%" PRIu64,
@@ -13034,7 +13065,7 @@ int ngtcp2_conn_update_rtt(ngtcp2_conn *conn, ngtcp2_duration rtt,
cstat->smoothed_rtt = (cstat->smoothed_rtt * 7 + rtt) / 8;
}
- ngtcp2_log_info(
+ ngtcp2_log_infof(
&conn->log, NGTCP2_LOG_EVENT_LDC,
"latest_rtt=%" PRIu64 " min_rtt=%" PRIu64 " smoothed_rtt=%" PRIu64
" rttvar=%" PRIu64 " ack_delay=%" PRIu64,
@@ -13049,16 +13080,7 @@ int ngtcp2_conn_update_rtt(ngtcp2_conn *conn, ngtcp2_duration rtt,
void ngtcp2_conn_get_conn_info_versioned(ngtcp2_conn *conn,
int conn_info_version,
ngtcp2_conn_info *cinfo) {
- const ngtcp2_conn_stat *cstat = &conn->cstat;
- (void)conn_info_version;
-
- cinfo->latest_rtt = cstat->latest_rtt;
- cinfo->min_rtt = cstat->min_rtt;
- cinfo->smoothed_rtt = cstat->smoothed_rtt;
- cinfo->rttvar = cstat->rttvar;
- cinfo->cwnd = cstat->cwnd;
- cinfo->ssthresh = cstat->ssthresh;
- cinfo->bytes_in_flight = cstat->bytes_in_flight;
+ ngtcp2_conn_info_init_versioned(conn_info_version, cinfo, &conn->cstat);
}
static void conn_get_loss_time_and_pktns(ngtcp2_conn *conn,
@@ -13140,9 +13162,10 @@ void ngtcp2_conn_set_loss_detection_timer(ngtcp2_conn *conn, ngtcp2_tstamp ts) {
if (earliest_loss_time != UINT64_MAX) {
cstat->loss_detection_timer = earliest_loss_time;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_LDC,
- "loss_detection_timer=%" PRIu64 " nonzero crypto loss time",
- cstat->loss_detection_timer);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_LDC,
+ "loss_detection_timer=%" PRIu64
+ " nonzero crypto loss time",
+ cstat->loss_detection_timer);
return;
}
@@ -13166,9 +13189,9 @@ void ngtcp2_conn_set_loss_detection_timer(ngtcp2_conn *conn, ngtcp2_tstamp ts) {
timeout =
cstat->loss_detection_timer > ts ? cstat->loss_detection_timer - ts : 0;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_LDC,
- "loss_detection_timer=%" PRIu64 " timeout=%" PRIu64,
- cstat->loss_detection_timer, timeout / NGTCP2_MILLISECONDS);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_LDC,
+ "loss_detection_timer=%" PRIu64 " timeout=%" PRIu64,
+ cstat->loss_detection_timer, timeout / NGTCP2_MILLISECONDS);
}
void ngtcp2_conn_cancel_loss_detection_timer(ngtcp2_conn *conn) {
@@ -13240,8 +13263,8 @@ int ngtcp2_conn_on_loss_detection_timer(ngtcp2_conn *conn, ngtcp2_tstamp ts) {
++cstat->pto_count;
- ngtcp2_log_info(&conn->log, NGTCP2_LOG_EVENT_LDC, "pto_count=%zu",
- cstat->pto_count);
+ ngtcp2_log_infof(&conn->log, NGTCP2_LOG_EVENT_LDC, "pto_count=%zu",
+ cstat->pto_count);
ngtcp2_conn_set_loss_detection_timer(conn, ts);
@@ -13967,6 +13990,10 @@ ngtcp2_ssize ngtcp2_conn_write_aggregate_pkt_versioned(
return nwrite;
}
+ngtcp2_tstamp ngtcp2_conn_get_timestamp(const ngtcp2_conn *conn) {
+ return conn->log.last_ts;
+}
+
const ngtcp2_path_history_entry *
ngtcp2_conn_find_path_history(ngtcp2_conn *conn, const ngtcp2_path *path,
ngtcp2_tstamp ts) {
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_conn.h b/contrib/libs/ngtcp2/lib/ngtcp2_conn.h
index 2d607d379fc..30a44e72664 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_conn.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_conn.h
@@ -77,10 +77,6 @@ typedef enum {
unreceived data. */
#define NGTCP2_MAX_REORDERED_CRYPTO_DATA 65536
-/* NGTCP2_MAX_RETRIES is the number of Retry packet which client can
- accept. */
-#define NGTCP2_MAX_RETRIES 3
-
/* NGTCP2_MAX_SCID_POOL_SIZE is the maximum number of source
connection ID the local endpoint provides to the remote endpoint.
The chosen value was described in old draft. Now a remote endpoint
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_conn_info.c b/contrib/libs/ngtcp2/lib/ngtcp2_conn_info.c
new file mode 100644
index 00000000000..84bb8820f50
--- /dev/null
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_conn_info.c
@@ -0,0 +1,50 @@
+/*
+ * ngtcp2
+ *
+ * Copyright (c) 2025 ngtcp2 contributors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include "ngtcp2_conn_info.h"
+#include "ngtcp2_conn_stat.h"
+
+void ngtcp2_conn_info_init_versioned(int conn_info_version,
+ ngtcp2_conn_info *cinfo,
+ const ngtcp2_conn_stat *cstat) {
+ cinfo->latest_rtt = cstat->latest_rtt;
+ cinfo->min_rtt = cstat->min_rtt;
+ cinfo->smoothed_rtt = cstat->smoothed_rtt;
+ cinfo->rttvar = cstat->rttvar;
+ cinfo->cwnd = cstat->cwnd;
+ cinfo->ssthresh = cstat->ssthresh;
+ cinfo->bytes_in_flight = cstat->bytes_in_flight;
+
+ switch (conn_info_version) {
+ case NGTCP2_CONN_INFO_V2:
+ cinfo->pkt_sent = cstat->pkt_sent;
+ cinfo->bytes_sent = cstat->bytes_sent;
+ cinfo->pkt_recv = cstat->pkt_recv;
+ cinfo->bytes_recv = cstat->bytes_recv;
+ cinfo->pkt_lost = cstat->pkt_lost;
+ cinfo->bytes_lost = cstat->bytes_lost;
+ cinfo->ping_recv = cstat->ping_recv;
+ cinfo->pkt_discarded = cstat->pkt_discarded;
+ }
+}
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_conn_info.h b/contrib/libs/ngtcp2/lib/ngtcp2_conn_info.h
new file mode 100644
index 00000000000..161309df304
--- /dev/null
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_conn_info.h
@@ -0,0 +1,45 @@
+/*
+ * ngtcp2
+ *
+ * Copyright (c) 2025 ngtcp2 contributors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef NGTCP2_CONN_INFO_H
+#define NGTCP2_CONN_INFO_H
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* defined(HAVE_CONFIG_H) */
+
+#include <ngtcp2/ngtcp2.h>
+
+typedef struct ngtcp2_conn_stat ngtcp2_conn_stat;
+
+/*
+ * ngtcp2_conn_info_init_versioned initializes |cinfo| of version
+ * |conn_info_version| from |cstat|. This function only fills the
+ * fields of |cinfo| that are available in the specified version.
+ */
+void ngtcp2_conn_info_init_versioned(int conn_info_version,
+ ngtcp2_conn_info *cinfo,
+ const ngtcp2_conn_stat *cstat);
+
+#endif /* !defined(NGTCP2_CONN_INFO_H) */
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_conn_stat.h b/contrib/libs/ngtcp2/lib/ngtcp2_conn_stat.h
index be041b90860..b5fea473910 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_conn_stat.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_conn_stat.h
@@ -31,6 +31,8 @@
#include <ngtcp2/ngtcp2.h>
+#include "ngtcp2_pktns_id.h"
+
/**
* @struct
*
@@ -128,6 +130,43 @@ typedef struct ngtcp2_conn_stat {
* scheduled and transmitted together.
*/
size_t send_quantum;
+ /*
+ * pkt_sent is the number of QUIC packets sent.
+ */
+ uint64_t pkt_sent;
+ /*
+ * bytes_sent is the number of bytes (the sum of QUIC packet length)
+ * sent.
+ */
+ uint64_t bytes_sent;
+ /*
+ * pkt_recv is the number of QUIC packets received, excluding
+ * discarded ones.
+ */
+ uint64_t pkt_recv;
+ /*
+ * bytes_recv is the number of bytes (the sum of QUIC packet length)
+ * received, excluding discarded ones.
+ */
+ uint64_t bytes_recv;
+ /*
+ * pkt_lost is the number of QUIC packets that are considered lost,
+ * excluding PMTUD packets.
+ */
+ uint64_t pkt_lost;
+ /*
+ * bytes_lost is the number of bytes (the sum of QUIC packet length)
+ * lost, excluding PMTUD packets.
+ */
+ uint64_t bytes_lost;
+ /*
+ * ping_recv is the number of PING frames received.
+ */
+ uint64_t ping_recv;
+ /*
+ * pkt_discarded is the number of QUIC packets discarded.
+ */
+ uint64_t pkt_discarded;
} ngtcp2_conn_stat;
#endif /* !defined(NGTCP2_CONN_STAT_H) */
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_log.c b/contrib/libs/ngtcp2/lib/ngtcp2_log.c
index e006c22e4e7..5c31f44a734 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_log.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_log.c
@@ -90,23 +90,10 @@ void ngtcp2_log_init(ngtcp2_log *log, const ngtcp2_cid *scid,
* Frame type in hex string.
*/
-#define NGTCP2_LOG_BUFLEN 4096
+#define NGTCP2_LOG_PKT "%s %" PRId64 " %s"
+#define NGTCP2_LOG_TP "remote transport_parameters"
-/* TODO Split second and remaining fraction with comma */
-#define NGTCP2_LOG_HD "I%08" PRIu64 " 0x%s %s"
-#define NGTCP2_LOG_PKT NGTCP2_LOG_HD " %s %" PRId64 " %s"
-#define NGTCP2_LOG_TP NGTCP2_LOG_HD " remote transport_parameters"
-
-#define NGTCP2_LOG_FRM_HD_FIELDS(DIR) \
- timestamp_cast(log->last_ts - log->ts), (const char *)log->scid, "frm", \
- (DIR), hd->pkt_num, strpkttype(hd)
-
-#define NGTCP2_LOG_PKT_HD_FIELDS(DIR) \
- timestamp_cast(log->last_ts - log->ts), (const char *)log->scid, "pkt", \
- (DIR), hd->pkt_num, strpkttype(hd)
-
-#define NGTCP2_LOG_TP_HD_FIELDS \
- timestamp_cast(log->last_ts - log->ts), (const char *)log->scid, "cry"
+#define NGTCP2_LOG_PKT_HD_FIELDS(DIR) (DIR), hd->pkt_num, strpkttype(hd)
static const char *strerrorcode(uint64_t error_code) {
switch (error_code) {
@@ -188,45 +175,19 @@ static const char *strpkttype(const ngtcp2_pkt_hd *hd) {
}
static const char *strpkttype_type_flags(uint8_t type, uint8_t flags) {
- ngtcp2_pkt_hd hd = {0};
-
- hd.type = type;
- hd.flags = flags;
-
- return strpkttype(&hd);
-}
-
-static const char *strevent(ngtcp2_log_event ev) {
- switch (ev) {
- case NGTCP2_LOG_EVENT_CON:
- return "con";
- case NGTCP2_LOG_EVENT_PKT:
- return "pkt";
- case NGTCP2_LOG_EVENT_FRM:
- return "frm";
- case NGTCP2_LOG_EVENT_LDC:
- return "ldc";
- case NGTCP2_LOG_EVENT_CRY:
- return "cry";
- case NGTCP2_LOG_EVENT_PTV:
- return "ptv";
- case NGTCP2_LOG_EVENT_CCA:
- return "cca";
- case NGTCP2_LOG_EVENT_NONE:
- default:
- return "non";
- }
+ return strpkttype(&(ngtcp2_pkt_hd){
+ .type = type,
+ .flags = flags,
+ });
}
-static uint64_t timestamp_cast(uint64_t ns) { return ns / NGTCP2_MILLISECONDS; }
-
static void log_fr_stream(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_stream *fr, const char *dir) {
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " STREAM(0x%02" PRIx64 ") id=0x%" PRIx64
- " fin=%d offset=%" PRIu64 " len=%" PRIu64 " uni=%d"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type | fr->flags, fr->stream_id, fr->fin,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " STREAM(0x%02" PRIx64 ") id=0x%" PRIx64
+ " fin=%d offset=%" PRIu64 " len=%" PRIu64 " uni=%d",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type | fr->flags, fr->stream_id, fr->fin,
fr->offset, ngtcp2_vec_len(fr->data, fr->datacnt),
(fr->stream_id & 0x2) != 0);
}
@@ -236,58 +197,58 @@ static void log_fr_ack(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
int64_t largest_ack, min_ack;
size_t i;
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " ACK(0x%02" PRIx64 ") largest_ack=%" PRId64
- " ack_delay=%" PRIu64 "(%" PRIu64 ") ack_range_count=%zu"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->largest_ack,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " ACK(0x%02" PRIx64 ") largest_ack=%" PRId64
+ " ack_delay=%" PRIu64 "(%" PRIu64 ") ack_range_count=%zu",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->largest_ack,
fr->ack_delay_unscaled / NGTCP2_MILLISECONDS, fr->ack_delay, fr->rangecnt);
largest_ack = fr->largest_ack;
min_ack = fr->largest_ack - (int64_t)fr->first_ack_range;
- log->log_printf(log->user_data,
- (NGTCP2_LOG_PKT " ACK(0x%02" PRIx64 ") range=[%" PRId64
- "..%" PRId64 "] len=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, largest_ack, min_ack,
- fr->first_ack_range);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " ACK(0x%02" PRIx64 ") range=[%" PRId64
+ "..%" PRId64 "] len=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, largest_ack,
+ min_ack, fr->first_ack_range);
for (i = 0; i < fr->rangecnt; ++i) {
const ngtcp2_ack_range *range = &fr->ranges[i];
largest_ack = min_ack - (int64_t)range->gap - 2;
min_ack = largest_ack - (int64_t)range->len;
- log->log_printf(log->user_data,
- (NGTCP2_LOG_PKT " ACK(0x%02" PRIx64 ") range=[%" PRId64
- "..%" PRId64 "] gap=%" PRIu64
- " len=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, largest_ack,
- min_ack, range->gap, range->len);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " ACK(0x%02" PRIx64 ") range=[%" PRId64
+ "..%" PRId64 "] gap=%" PRIu64
+ " len=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, largest_ack,
+ min_ack, range->gap, range->len);
}
if (fr->type == NGTCP2_FRAME_ACK_ECN) {
- log->log_printf(log->user_data,
- (NGTCP2_LOG_PKT " ACK(0x%02" PRIx64 ") ect0=%" PRIu64
- " ect1=%" PRIu64 " ce=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->ecn.ect0,
- fr->ecn.ect1, fr->ecn.ce);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " ACK(0x%02" PRIx64 ") ect0=%" PRIu64
+ " ect1=%" PRIu64 " ce=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->ecn.ect0,
+ fr->ecn.ect1, fr->ecn.ce);
}
}
static void log_fr_padding(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_padding *fr, const char *dir) {
- log->log_printf(log->user_data,
- (NGTCP2_LOG_PKT " PADDING(0x%02" PRIx64 ") len=%zu"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->len);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " PADDING(0x%02" PRIx64 ") len=%zu",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->len);
}
static void log_fr_reset_stream(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_reset_stream *fr,
const char *dir) {
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " RESET_STREAM(0x%02" PRIx64 ") id=0x%" PRIx64
- " app_error_code=%s(0x%" PRIx64 ") final_size=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->stream_id,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " RESET_STREAM(0x%02" PRIx64 ") id=0x%" PRIx64
+ " app_error_code=%s(0x%" PRIx64 ") final_size=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->stream_id,
strapperrorcode(fr->app_error_code), fr->app_error_code, fr->final_size);
}
@@ -297,12 +258,12 @@ static void log_fr_connection_close(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
char reason[256];
size_t reasonlen = ngtcp2_min_size(sizeof(reason) - 1, fr->reasonlen);
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " CONNECTION_CLOSE(0x%02" PRIx64
- ") error_code=%s(0x%" PRIx64 ") "
- "frame_type=%" PRIx64 " reason_len=%zu reason=[%s]"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " CONNECTION_CLOSE(0x%02" PRIx64 ") error_code=%s(0x%" PRIx64
+ ") "
+ "frame_type=%" PRIx64 " reason_len=%zu reason=[%s]",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type,
fr->type == NGTCP2_FRAME_CONNECTION_CLOSE ? strerrorcode(fr->error_code)
: strapperrorcode(fr->error_code),
fr->error_code, fr->frame_type, fr->reasonlen,
@@ -311,63 +272,64 @@ static void log_fr_connection_close(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
static void log_fr_max_data(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_max_data *fr, const char *dir) {
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " MAX_DATA(0x%02" PRIx64 ") max_data=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->max_data);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " MAX_DATA(0x%02" PRIx64
+ ") max_data=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->max_data);
}
static void log_fr_max_stream_data(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_max_stream_data *fr,
const char *dir) {
- log->log_printf(log->user_data,
- (NGTCP2_LOG_PKT " MAX_STREAM_DATA(0x%02" PRIx64
- ") id=0x%" PRIx64
- " max_stream_data=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->stream_id,
- fr->max_stream_data);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " MAX_STREAM_DATA(0x%02" PRIx64
+ ") id=0x%" PRIx64
+ " max_stream_data=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->stream_id,
+ fr->max_stream_data);
}
static void log_fr_max_streams(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_max_streams *fr, const char *dir) {
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " MAX_STREAMS(0x%02" PRIx64 ") max_streams=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->max_streams);
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " MAX_STREAMS(0x%02" PRIx64 ") max_streams=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->max_streams);
}
static void log_fr_ping(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_ping *fr, const char *dir) {
- log->log_printf(log->user_data, (NGTCP2_LOG_PKT " PING(0x%02" PRIx64 ")"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " PING(0x%02" PRIx64 ")",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type);
}
static void log_fr_data_blocked(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_data_blocked *fr,
const char *dir) {
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " DATA_BLOCKED(0x%02" PRIx64 ") offset=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->offset);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " DATA_BLOCKED(0x%02" PRIx64
+ ") offset=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->offset);
}
static void log_fr_stream_data_blocked(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_stream_data_blocked *fr,
const char *dir) {
- log->log_printf(log->user_data,
- (NGTCP2_LOG_PKT " STREAM_DATA_BLOCKED(0x%02" PRIx64
- ") id=0x%" PRIx64 " offset=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->stream_id,
- fr->offset);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " STREAM_DATA_BLOCKED(0x%02" PRIx64
+ ") id=0x%" PRIx64 " offset=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->stream_id,
+ fr->offset);
}
static void log_fr_streams_blocked(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_streams_blocked *fr,
const char *dir) {
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " STREAMS_BLOCKED(0x%02" PRIx64 ") max_streams=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->max_streams);
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " STREAMS_BLOCKED(0x%02" PRIx64 ") max_streams=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->max_streams);
}
static void log_fr_new_connection_id(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
@@ -376,12 +338,12 @@ static void log_fr_new_connection_id(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
uint8_t buf[sizeof(fr->stateless_reset_token) * 2 + 1];
uint8_t cid[sizeof(fr->cid.data) * 2 + 1];
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " NEW_CONNECTION_ID(0x%02" PRIx64 ") seq=%" PRIu64
- " cid=0x%s retire_prior_to=%" PRIu64
- " stateless_reset_token=0x%s"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->seq,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " NEW_CONNECTION_ID(0x%02" PRIx64 ") seq=%" PRIu64
+ " cid=0x%s retire_prior_to=%" PRIu64
+ " stateless_reset_token=0x%s",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->seq,
(const char *)ngtcp2_encode_hex(cid, fr->cid.data, fr->cid.datalen),
fr->retire_prior_to,
(const char *)ngtcp2_encode_hex(buf, fr->stateless_reset_token,
@@ -391,11 +353,12 @@ static void log_fr_new_connection_id(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
static void log_fr_stop_sending(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_stop_sending *fr,
const char *dir) {
- log->log_printf(log->user_data,
- (NGTCP2_LOG_PKT " STOP_SENDING(0x%02" PRIx64 ") id=0x%" PRIx64
- " app_error_code=%s(0x%" PRIx64 ")"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->stream_id,
- strapperrorcode(fr->app_error_code), fr->app_error_code);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " STOP_SENDING(0x%02" PRIx64
+ ") id=0x%" PRIx64
+ " app_error_code=%s(0x%" PRIx64 ")",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->stream_id,
+ strapperrorcode(fr->app_error_code), fr->app_error_code);
}
static void log_fr_path_challenge(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
@@ -403,10 +366,10 @@ static void log_fr_path_challenge(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const char *dir) {
uint8_t buf[sizeof(fr->data) * 2 + 1];
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " PATH_CHALLENGE(0x%02" PRIx64 ") data=0x%s"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " PATH_CHALLENGE(0x%02" PRIx64 ") data=0x%s",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type,
(const char *)ngtcp2_encode_hex(buf, fr->data, sizeof(fr->data)));
}
@@ -415,20 +378,20 @@ static void log_fr_path_response(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const char *dir) {
uint8_t buf[sizeof(fr->data) * 2 + 1];
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " PATH_RESPONSE(0x%02" PRIx64 ") data=0x%s"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " PATH_RESPONSE(0x%02" PRIx64 ") data=0x%s",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type,
(const char *)ngtcp2_encode_hex(buf, fr->data, sizeof(fr->data)));
}
static void log_fr_crypto(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_stream *fr, const char *dir) {
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " CRYPTO(0x%02" PRIx64 ") offset=%" PRIu64 " len=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->offset,
- ngtcp2_vec_len(fr->data, fr->datacnt));
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " CRYPTO(0x%02" PRIx64 ") offset=%" PRIu64
+ " len=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->offset,
+ ngtcp2_vec_len(fr->data, fr->datacnt));
}
static void log_fr_new_token(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
@@ -445,36 +408,37 @@ static void log_fr_new_token(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
} else {
p = ngtcp2_encode_hex(buf, fr->token, fr->tokenlen);
}
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " NEW_TOKEN(0x%02" PRIx64 ") token=0x%s len=%zu"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, (const char *)p, fr->tokenlen);
+
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " NEW_TOKEN(0x%02" PRIx64 ") token=0x%s len=%zu",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, (const char *)p, fr->tokenlen);
}
static void log_fr_retire_connection_id(ngtcp2_log *log,
const ngtcp2_pkt_hd *hd,
const ngtcp2_retire_connection_id *fr,
const char *dir) {
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_PKT " RETIRE_CONNECTION_ID(0x%02" PRIx64 ") seq=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type, fr->seq);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " RETIRE_CONNECTION_ID(0x%02" PRIx64
+ ") seq=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type, fr->seq);
}
static void log_fr_handshake_done(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_handshake_done *fr,
const char *dir) {
- log->log_printf(log->user_data,
- (NGTCP2_LOG_PKT " HANDSHAKE_DONE(0x%02" PRIx64 ")"),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " HANDSHAKE_DONE(0x%02" PRIx64 ")",
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type);
}
static void log_fr_datagram(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
const ngtcp2_datagram *fr, const char *dir) {
- log->log_printf(log->user_data,
- (NGTCP2_LOG_PKT " DATAGRAM(0x%02" PRIx64 ") len=%" PRIu64),
- NGTCP2_LOG_FRM_HD_FIELDS(dir), fr->type,
- ngtcp2_vec_len(fr->data, fr->datacnt));
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_FRM,
+ NGTCP2_LOG_PKT " DATAGRAM(0x%02" PRIx64 ") len=%" PRIu64,
+ NGTCP2_LOG_PKT_HD_FIELDS(dir), fr->type,
+ ngtcp2_vec_len(fr->data, fr->datacnt));
}
static void log_fr(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
@@ -580,8 +544,8 @@ void ngtcp2_log_rx_vn(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
}
for (i = 0; i < nsv; ++i) {
- log->log_printf(log->user_data, (NGTCP2_LOG_PKT " v=0x%08x"),
- NGTCP2_LOG_PKT_HD_FIELDS("rx"), sv[i]);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_PKT, NGTCP2_LOG_PKT " v=0x%08x",
+ NGTCP2_LOG_PKT_HD_FIELDS("rx"), sv[i]);
}
}
@@ -598,8 +562,8 @@ void ngtcp2_log_rx_sr(ngtcp2_log *log, const ngtcp2_pkt_stateless_reset *sr) {
.type = NGTCP2_PKT_STATELESS_RESET,
};
- log->log_printf(
- log->user_data, (NGTCP2_LOG_PKT " token=0x%s randlen=%zu"),
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_PKT, NGTCP2_LOG_PKT " token=0x%s randlen=%zu",
NGTCP2_LOG_PKT_HD_FIELDS("rx"),
(const char *)ngtcp2_encode_hex(buf, sr->stateless_reset_token,
sizeof(sr->stateless_reset_token)),
@@ -622,9 +586,8 @@ void ngtcp2_log_remote_tp(ngtcp2_log *log,
}
if (params->stateless_reset_token_present) {
- log->log_printf(
- log->user_data, (NGTCP2_LOG_TP " stateless_reset_token=0x%s"),
- NGTCP2_LOG_TP_HD_FIELDS,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_CRY, NGTCP2_LOG_TP " stateless_reset_token=0x%s",
(const char *)ngtcp2_encode_hex(token, params->stateless_reset_token,
sizeof(params->stateless_reset_token)));
}
@@ -633,116 +596,113 @@ void ngtcp2_log_remote_tp(ngtcp2_log *log,
if (params->preferred_addr.ipv4_present) {
sa_in = &params->preferred_addr.ipv4;
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " preferred_address.ipv4_addr=%s"),
- NGTCP2_LOG_TP_HD_FIELDS,
- (const char *)ngtcp2_encode_ipv4(
- addr, (const uint8_t *)&sa_in->sin_addr));
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " preferred_address.ipv4_port=%u"),
- NGTCP2_LOG_TP_HD_FIELDS, ngtcp2_ntohs(sa_in->sin_port));
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " preferred_address.ipv4_addr=%s",
+ (const char *)ngtcp2_encode_ipv4(
+ addr, (const uint8_t *)&sa_in->sin_addr));
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " preferred_address.ipv4_port=%u",
+ ngtcp2_ntohs(sa_in->sin_port));
}
if (params->preferred_addr.ipv6_present) {
sa_in6 = &params->preferred_addr.ipv6;
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " preferred_address.ipv6_addr=%s"),
- NGTCP2_LOG_TP_HD_FIELDS,
- (const char *)ngtcp2_encode_ipv6(
- addr, (const uint8_t *)&sa_in6->sin6_addr));
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " preferred_address.ipv6_port=%u"),
- NGTCP2_LOG_TP_HD_FIELDS, ngtcp2_ntohs(sa_in6->sin6_port));
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " preferred_address.ipv6_addr=%s",
+ (const char *)ngtcp2_encode_ipv6(
+ addr, (const uint8_t *)&sa_in6->sin6_addr));
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " preferred_address.ipv6_port=%u",
+ ngtcp2_ntohs(sa_in6->sin6_port));
}
- log->log_printf(
- log->user_data, (NGTCP2_LOG_TP " preferred_address.cid=0x%s"),
- NGTCP2_LOG_TP_HD_FIELDS,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_CRY, NGTCP2_LOG_TP " preferred_address.cid=0x%s",
(const char *)ngtcp2_encode_hex(cid, params->preferred_addr.cid.data,
params->preferred_addr.cid.datalen));
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_TP " preferred_address.stateless_reset_token=0x%s"),
- NGTCP2_LOG_TP_HD_FIELDS,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " preferred_address.stateless_reset_token=0x%s",
(const char *)ngtcp2_encode_hex(
token, params->preferred_addr.stateless_reset_token,
sizeof(params->preferred_addr.stateless_reset_token)));
}
if (params->original_dcid_present) {
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_TP " original_destination_connection_id=0x%s"),
- NGTCP2_LOG_TP_HD_FIELDS,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " original_destination_connection_id=0x%s",
(const char *)ngtcp2_encode_hex(cid, params->original_dcid.data,
params->original_dcid.datalen));
}
if (params->retry_scid_present) {
- log->log_printf(
- log->user_data, (NGTCP2_LOG_TP " retry_source_connection_id=0x%s"),
- NGTCP2_LOG_TP_HD_FIELDS,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " retry_source_connection_id=0x%s",
(const char *)ngtcp2_encode_hex(cid, params->retry_scid.data,
params->retry_scid.datalen));
}
if (params->initial_scid_present) {
- log->log_printf(
- log->user_data, (NGTCP2_LOG_TP " initial_source_connection_id=0x%s"),
- NGTCP2_LOG_TP_HD_FIELDS,
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " initial_source_connection_id=0x%s",
(const char *)ngtcp2_encode_hex(cid, params->initial_scid.data,
params->initial_scid.datalen));
}
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_TP " initial_max_stream_data_bidi_local=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS, params->initial_max_stream_data_bidi_local);
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_TP " initial_max_stream_data_bidi_remote=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS, params->initial_max_stream_data_bidi_remote);
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " initial_max_stream_data_uni=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS, params->initial_max_stream_data_uni);
- log->log_printf(log->user_data, (NGTCP2_LOG_TP " initial_max_data=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS, params->initial_max_data);
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " initial_max_streams_bidi=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS, params->initial_max_streams_bidi);
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " initial_max_streams_uni=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS, params->initial_max_streams_uni);
- log->log_printf(log->user_data, (NGTCP2_LOG_TP " max_idle_timeout=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS,
- params->max_idle_timeout / NGTCP2_MILLISECONDS);
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " max_udp_payload_size=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS, params->max_udp_payload_size);
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " ack_delay_exponent=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS, params->ack_delay_exponent);
- log->log_printf(log->user_data, (NGTCP2_LOG_TP " max_ack_delay=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS,
- params->max_ack_delay / NGTCP2_MILLISECONDS);
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " active_connection_id_limit=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS, params->active_connection_id_limit);
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " disable_active_migration=%d"),
- NGTCP2_LOG_TP_HD_FIELDS, params->disable_active_migration);
- log->log_printf(log->user_data,
- (NGTCP2_LOG_TP " max_datagram_frame_size=%" PRIu64),
- NGTCP2_LOG_TP_HD_FIELDS, params->max_datagram_frame_size);
- log->log_printf(log->user_data, (NGTCP2_LOG_TP " grease_quic_bit=%d"),
- NGTCP2_LOG_TP_HD_FIELDS, params->grease_quic_bit);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP
+ " initial_max_stream_data_bidi_local=%" PRIu64,
+ params->initial_max_stream_data_bidi_local);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP
+ " initial_max_stream_data_bidi_remote=%" PRIu64,
+ params->initial_max_stream_data_bidi_remote);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " initial_max_stream_data_uni=%" PRIu64,
+ params->initial_max_stream_data_uni);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " initial_max_data=%" PRIu64,
+ params->initial_max_data);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " initial_max_streams_bidi=%" PRIu64,
+ params->initial_max_streams_bidi);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " initial_max_streams_uni=%" PRIu64,
+ params->initial_max_streams_uni);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " max_idle_timeout=%" PRIu64,
+ params->max_idle_timeout / NGTCP2_MILLISECONDS);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " max_udp_payload_size=%" PRIu64,
+ params->max_udp_payload_size);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " ack_delay_exponent=%" PRIu64,
+ params->ack_delay_exponent);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " max_ack_delay=%" PRIu64,
+ params->max_ack_delay / NGTCP2_MILLISECONDS);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " active_connection_id_limit=%" PRIu64,
+ params->active_connection_id_limit);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " disable_active_migration=%d",
+ params->disable_active_migration);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " max_datagram_frame_size=%" PRIu64,
+ params->max_datagram_frame_size);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " grease_quic_bit=%d",
+ params->grease_quic_bit);
if (params->version_info_present) {
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_TP " version_information.chosen_version=0x%08x"),
- NGTCP2_LOG_TP_HD_FIELDS, params->version_info.chosen_version);
+ ngtcp2_log_infof_raw(log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP
+ " version_information.chosen_version=0x%08x",
+ params->version_info.chosen_version);
assert(!(params->version_info.available_versionslen & 0x3));
@@ -751,10 +711,10 @@ void ngtcp2_log_remote_tp(ngtcp2_log *log,
i += sizeof(uint32_t)) {
p = ngtcp2_get_uint32be(&version, p);
- log->log_printf(
- log->user_data,
- (NGTCP2_LOG_TP " version_information.available_versions[%zu]=0x%08x"),
- NGTCP2_LOG_TP_HD_FIELDS, i >> 2, version);
+ ngtcp2_log_infof_raw(
+ log, NGTCP2_LOG_EVENT_CRY,
+ NGTCP2_LOG_TP " version_information.available_versions[%zu]=0x%08x",
+ i >> 2, version);
}
}
}
@@ -765,9 +725,9 @@ void ngtcp2_log_pkt_lost(ngtcp2_log *log, int64_t pkt_num, uint8_t type,
return;
}
- ngtcp2_log_info(log, NGTCP2_LOG_EVENT_LDC,
- "pkn=%" PRId64 " lost type=%s sent_ts=%" PRIu64, pkt_num,
- strpkttype_type_flags(type, flags), sent_ts);
+ ngtcp2_log_infof(log, NGTCP2_LOG_EVENT_LDC,
+ "pkn=%" PRId64 " lost type=%s sent_ts=%" PRIu64, pkt_num,
+ strpkttype_type_flags(type, flags), sent_ts);
}
static void log_pkt_hd(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
@@ -780,13 +740,13 @@ static void log_pkt_hd(ngtcp2_log *log, const ngtcp2_pkt_hd *hd,
}
if (hd->type == NGTCP2_PKT_1RTT) {
- ngtcp2_log_info(
+ ngtcp2_log_infof(
log, NGTCP2_LOG_EVENT_PKT, "%s pkn=%" PRId64 " dcid=0x%s type=%s k=%d",
dir, hd->pkt_num,
(const char *)ngtcp2_encode_hex(dcid, hd->dcid.data, hd->dcid.datalen),
strpkttype(hd), (hd->flags & NGTCP2_PKT_FLAG_KEY_PHASE) != 0);
} else {
- ngtcp2_log_info(
+ ngtcp2_log_infof(
log, NGTCP2_LOG_EVENT_PKT,
"%s pkn=%" PRId64 " dcid=0x%s scid=0x%s version=0x%08x type=%s len=%zu",
dir, hd->pkt_num,
@@ -804,31 +764,12 @@ void ngtcp2_log_tx_pkt_hd(ngtcp2_log *log, const ngtcp2_pkt_hd *hd) {
log_pkt_hd(log, hd, "tx");
}
-void ngtcp2_log_info(ngtcp2_log *log, ngtcp2_log_event ev, const char *fmt,
- ...) {
- va_list ap;
- int n;
- char buf[NGTCP2_LOG_BUFLEN];
-
- if (!log->log_printf || !(log->events & ev)) {
- return;
- }
-
- va_start(ap, fmt);
- n = vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
-
- if (n < 0 || (size_t)n >= sizeof(buf)) {
- return;
- }
-
- log->log_printf(log->user_data, (NGTCP2_LOG_HD " %s"),
- timestamp_cast(log->last_ts - log->ts), log->scid,
- strevent(ev), buf);
+void ngtcp2_log_tx_cancel(ngtcp2_log *log, const ngtcp2_pkt_hd *hd) {
+ ngtcp2_log_infof(log, NGTCP2_LOG_EVENT_PKT,
+ "cancel tx pkn=%" PRId64 " type=%s", hd->pkt_num,
+ strpkttype(hd));
}
-void ngtcp2_log_tx_cancel(ngtcp2_log *log, const ngtcp2_pkt_hd *hd) {
- ngtcp2_log_info(log, NGTCP2_LOG_EVENT_PKT,
- "cancel tx pkn=%" PRId64 " type=%s", hd->pkt_num,
- strpkttype(hd));
+uint64_t ngtcp2_log_timestamp(const ngtcp2_log *log) {
+ return (log->last_ts - log->ts) / NGTCP2_MILLISECONDS;
}
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_log.h b/contrib/libs/ngtcp2/lib/ngtcp2_log.h
index 13fb81a72e1..707cd3089e5 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_log.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_log.h
@@ -121,12 +121,71 @@ void ngtcp2_log_tx_pkt_hd(ngtcp2_log *log, const ngtcp2_pkt_hd *hd);
void ngtcp2_log_tx_cancel(ngtcp2_log *log, const ngtcp2_pkt_hd *hd);
+#define NGTCP2_LOG_HD "I%08" PRIu64 " 0x%s %s"
+
+uint64_t ngtcp2_log_timestamp(const ngtcp2_log *log);
+
+static inline const char *ngtcp2_log_event_str(ngtcp2_log_event ev) {
+ switch (ev) {
+ case NGTCP2_LOG_EVENT_CON:
+ return "con";
+ case NGTCP2_LOG_EVENT_PKT:
+ return "pkt";
+ case NGTCP2_LOG_EVENT_FRM:
+ return "frm";
+ case NGTCP2_LOG_EVENT_LDC:
+ return "ldc";
+ case NGTCP2_LOG_EVENT_CRY:
+ return "cry";
+ case NGTCP2_LOG_EVENT_PTV:
+ return "ptv";
+ case NGTCP2_LOG_EVENT_CCA:
+ return "cca";
+ case NGTCP2_LOG_EVENT_NONE:
+ default:
+ return "non";
+ }
+}
+
+#define ngtcp2_log_infof_raw(LOG, EV, FMT, ...) \
+ (LOG)->log_printf((LOG)->user_data, NGTCP2_LOG_HD " " FMT, \
+ ngtcp2_log_timestamp(LOG), (LOG)->scid, \
+ ngtcp2_log_event_str(EV), __VA_ARGS__);
+
+/**
+ * @function
+ *
+ * `ngtcp2_log_infof` writes info level log with printf like
+ * formatting.
+ */
+#define ngtcp2_log_infof(LOG, EV, FMT, ...) \
+ do { \
+ if (!(LOG)->log_printf || !((LOG)->events & (EV))) { \
+ break; \
+ } \
+ \
+ ngtcp2_log_infof_raw((LOG), (EV), FMT, __VA_ARGS__); \
+ } while (0)
+
+#define ngtcp2_log_info_raw(LOG, EV, FMT) \
+ (LOG)->log_printf((LOG)->user_data, NGTCP2_LOG_HD " " FMT, \
+ ngtcp2_log_timestamp(LOG), (LOG)->scid, \
+ ngtcp2_log_event_str(EV))
+
/**
* @function
*
- * `ngtcp2_log_info` writes info level log.
+ * `ngtcp2_log_info` writes info level log. FMT should not contain
+ * formatting directive. This function exists to workaround the issue
+ * that __VA_ARGS__ cannot be empty.
*/
-void ngtcp2_log_info(ngtcp2_log *log, ngtcp2_log_event ev, const char *fmt,
- ...);
+#define ngtcp2_log_info(LOG, EV, FMT) \
+ do { \
+ if (!(LOG)->log_printf || !((LOG)->events & (EV))) { \
+ break; \
+ } \
+ \
+ ngtcp2_log_info_raw((LOG), (EV), FMT); \
+ } while (0)
#endif /* !defined(NGTCP2_LOG_H) */
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_qlog.c b/contrib/libs/ngtcp2/lib/ngtcp2_qlog.c
index c0f920746a4..19667e17dba 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_qlog.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_qlog.c
@@ -227,13 +227,11 @@ void ngtcp2_qlog_start(ngtcp2_qlog *qlog, const ngtcp2_cid *odcid, int server) {
}
void ngtcp2_qlog_end(ngtcp2_qlog *qlog) {
- uint8_t buf[1] = {0};
-
if (!qlog->write) {
return;
}
- qlog->write(qlog->user_data, NGTCP2_QLOG_WRITE_FLAG_FIN, &buf, 0);
+ qlog->write(qlog->user_data, NGTCP2_QLOG_WRITE_FLAG_FIN, "", 0);
}
static ngtcp2_vec vec_pkt_type_initial = ngtcp2_make_vec_lit("initial");
@@ -1095,7 +1093,6 @@ void ngtcp2_qlog_metrics_updated(ngtcp2_qlog *qlog,
void ngtcp2_qlog_pkt_lost(ngtcp2_qlog *qlog, ngtcp2_rtb_entry *ent) {
uint8_t buf[256];
uint8_t *p = buf;
- ngtcp2_pkt_hd hd = {0};
if (!qlog->write) {
return;
@@ -1107,11 +1104,11 @@ void ngtcp2_qlog_pkt_lost(ngtcp2_qlog *qlog, ngtcp2_rtb_entry *ent) {
p = write_verbatim(
p, ",\"name\":\"recovery:packet_lost\",\"data\":{\"header\":");
- hd.type = ent->hd.type;
- hd.flags = ent->hd.flags;
- hd.pkt_num = ent->hd.pkt_num;
-
- p = write_pkt_hd(p, &hd);
+ p = write_pkt_hd(p, &(ngtcp2_pkt_hd){
+ .pkt_num = ent->hd.pkt_num,
+ .type = ent->hd.type,
+ .flags = ent->hd.flags,
+ });
p = write_verbatim(p, "}}\n");
qlog->write(qlog->user_data, NGTCP2_QLOG_WRITE_FLAG_NONE, buf,
@@ -1154,20 +1151,19 @@ void ngtcp2_qlog_stateless_reset_pkt_received(
ngtcp2_qlog *qlog, const ngtcp2_pkt_stateless_reset *sr) {
uint8_t buf[256];
uint8_t *p = buf;
- ngtcp2_pkt_hd hd = {0};
if (!qlog->write) {
return;
}
- hd.type = NGTCP2_PKT_STATELESS_RESET;
-
*p++ = '\x1e';
*p++ = '{';
p = qlog_write_time(qlog, p);
p = write_verbatim(
p, ",\"name\":\"transport:packet_received\",\"data\":{\"header\":");
- p = write_pkt_hd(p, &hd);
+ p = write_pkt_hd(p, &(ngtcp2_pkt_hd){
+ .type = NGTCP2_PKT_STATELESS_RESET,
+ });
*p++ = ',';
p = write_pair_hex(p, "stateless_reset_token", sr->stateless_reset_token,
NGTCP2_STATELESS_RESET_TOKENLEN);
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_range.c b/contrib/libs/ngtcp2/lib/ngtcp2_range.c
index e8989153293..15f393b85d3 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_range.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_range.c
@@ -32,12 +32,14 @@ void ngtcp2_range_init(ngtcp2_range *r, uint64_t begin, uint64_t end) {
ngtcp2_range ngtcp2_range_intersect(const ngtcp2_range *a,
const ngtcp2_range *b) {
- ngtcp2_range r = {0};
+ ngtcp2_range r;
uint64_t begin = ngtcp2_max_uint64(a->begin, b->begin);
uint64_t end = ngtcp2_min_uint64(a->end, b->end);
if (begin < end) {
ngtcp2_range_init(&r, begin, end);
+ } else {
+ r = (ngtcp2_range){0};
}
return r;
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_ratelim.c b/contrib/libs/ngtcp2/lib/ngtcp2_ratelim.c
index efedc3daa76..d13ed9a14aa 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_ratelim.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_ratelim.c
@@ -41,7 +41,7 @@ void ngtcp2_ratelim_init(ngtcp2_ratelim *rlim, uint64_t burst, uint64_t rate,
/* ratelim_update updates rlim->tokens with the current |ts|. */
static void ratelim_update(ngtcp2_ratelim *rlim, ngtcp2_tstamp ts) {
- uint64_t d, gain;
+ uint64_t d, gain, gps;
assert(ts >= rlim->ts);
@@ -52,16 +52,23 @@ static void ratelim_update(ngtcp2_ratelim *rlim, ngtcp2_tstamp ts) {
d = ts - rlim->ts;
rlim->ts = ts;
- gain = rlim->rate * d + rlim->carry;
+ if (rlim->rate > (UINT64_MAX - rlim->carry) / d) {
+ gain = UINT64_MAX;
+ } else {
+ gain = rlim->rate * d + rlim->carry;
+ }
- rlim->tokens += gain / NGTCP2_SECONDS;
+ gps = gain / NGTCP2_SECONDS;
- if (rlim->tokens < rlim->burst) {
+ if (gps < rlim->burst && rlim->tokens < rlim->burst - gps) {
+ rlim->tokens += gps;
rlim->carry = gain % NGTCP2_SECONDS;
- } else {
- rlim->tokens = rlim->burst;
- rlim->carry = 0;
+
+ return;
}
+
+ rlim->tokens = rlim->burst;
+ rlim->carry = 0;
}
int ngtcp2_ratelim_drain(ngtcp2_ratelim *rlim, uint64_t n, ngtcp2_tstamp ts) {
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_ratelim.h b/contrib/libs/ngtcp2/lib/ngtcp2_ratelim.h
index 14485c562d4..231f5d1b018 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_ratelim.h
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_ratelim.h
@@ -28,7 +28,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif /* HAVE_CONFIG_H */
+#endif /* defined(HAVE_CONFIG_H) */
#include <ngtcp2/ngtcp2.h>
diff --git a/contrib/libs/ngtcp2/lib/ngtcp2_rtb.c b/contrib/libs/ngtcp2/lib/ngtcp2_rtb.c
index 7df1c197db7..f51c0f14ef9 100644
--- a/contrib/libs/ngtcp2/lib/ngtcp2_rtb.c
+++ b/contrib/libs/ngtcp2/lib/ngtcp2_rtb.c
@@ -454,23 +454,28 @@ static int rtb_on_pkt_lost(ngtcp2_rtb *rtb, ngtcp2_rtb_entry *ent,
if (ent->flags &
(NGTCP2_RTB_ENTRY_FLAG_PMTUD_PROBE | NGTCP2_RTB_ENTRY_FLAG_SKIP)) {
++rtb->num_lost_ignore_pkts;
- } else if (ent->hd.pkt_num >= rtb->cc_pkt_num) {
- rtb->rst->lost += ent->pktlen;
-
- if (rtb->cc->on_pkt_lost) {
- cc->on_pkt_lost(cc, cstat,
- ngtcp2_cc_pkt_init(&pkt, ent->hd.pkt_num, ent->pktlen,
- pktns->id, ent->ts, ent->rst.lost,
- ent->rst.tx_in_flight,
- ent->rst.is_app_limited),
- ts);
+ } else {
+ ++cstat->pkt_lost;
+ cstat->bytes_lost += ent->pktlen;
+
+ if (ent->hd.pkt_num >= rtb->cc_pkt_num) {
+ rtb->rst->lost += ent->pktlen;
+
+ if (rtb->cc->on_pkt_lost) {
+ cc->on_pkt_lost(cc, cstat,
+ ngtcp2_cc_pkt_init(&pkt, ent->hd.pkt_num, ent->pktlen,
+ pktns->id, ent->ts, ent->rst.lost,
+ ent->rst.tx_in_flight,
+ ent->rst.is_app_limited),
+ ts);
+ }
}
}
if (ent->flags & NGTCP2_RTB_ENTRY_FLAG_PTO_RECLAIMED) {
- ngtcp2_log_info(rtb->log, NGTCP2_LOG_EVENT_LDC,
- "pkn=%" PRId64 " has already been reclaimed on PTO",
- ent->hd.pkt_num);
+ ngtcp2_log_infof(rtb->log, NGTCP2_LOG_EVENT_LDC,
+ "pkn=%" PRId64 " has already been reclaimed on PTO",
+ ent->hd.pkt_num);
assert(!(ent->flags & NGTCP2_RTB_ENTRY_FLAG_LOST_RETRANSMITTED));
assert(UINT64_MAX == ent->lost_ts);
} else {
@@ -793,12 +798,12 @@ ngtcp2_ssize ngtcp2_rtb_recv_ack(ngtcp2_rtb *rtb, const ngtcp2_ack *fr,
int ack_eliciting_pkt_acked = 0;
size_t ecn_acked = 0;
int verify_ecn = 0;
- ngtcp2_cc_ack cc_ack = {0};
+ ngtcp2_cc_ack cc_ack = {
+ .prior_bytes_in_flight = cstat->bytes_in_flight,
+ .rtt = UINT64_MAX,
+ };
size_t num_lost_pkts = rtb->num_lost_pkts - rtb->num_lost_ignore_pkts;
- cc_ack.prior_bytes_in_flight = cstat->bytes_in_flight;
- cc_ack.rtt = UINT64_MAX;
-
if (conn && (conn->flags & NGTCP2_CONN_FLAG_KEY_UPDATE_NOT_CONFIRMED) &&
(conn->flags & NGTCP2_CONN_FLAG_KEY_UPDATE_INITIATOR) &&
largest_ack >= conn->pktns.crypto.tx.ckm->pkt_num) {
@@ -1153,10 +1158,10 @@ static int rtb_detect_lost_pkt(ngtcp2_rtb *rtb, uint64_t *ppkt_lost,
*/
if (pktns->id == NGTCP2_PKTNS_ID_APPLICATION && loss_window &&
loss_window >= congestion_period) {
- ngtcp2_log_info(rtb->log, NGTCP2_LOG_EVENT_LDC,
- "persistent congestion loss_window=%" PRIu64
- " congestion_period=%" PRIu64,
- loss_window, congestion_period);
+ ngtcp2_log_infof(rtb->log, NGTCP2_LOG_EVENT_LDC,
+ "persistent congestion loss_window=%" PRIu64
+ " congestion_period=%" PRIu64,
+ loss_window, congestion_period);
/* Reset min_rtt, srtt, and rttvar here. Next new RTT
sample will be used to recalculate these values. */
@@ -1203,8 +1208,8 @@ void ngtcp2_rtb_remove_excessive_lost_pkt(ngtcp2_rtb *rtb, size_t n) {
assert(ent->flags & NGTCP2_RTB_ENTRY_FLAG_LOST_RETRANSMITTED);
- ngtcp2_log_info(rtb->log, NGTCP2_LOG_EVENT_LDC,
- "removing stale lost pkn=%" PRId64, ent->hd.pkt_num);
+ ngtcp2_log_infof(rtb->log, NGTCP2_LOG_EVENT_LDC,
+ "removing stale lost pkn=%" PRId64, ent->hd.pkt_num);
--rtb->num_lost_pkts;
@@ -1245,8 +1250,8 @@ void ngtcp2_rtb_remove_expired_lost_pkt(ngtcp2_rtb *rtb,
return;
}
- ngtcp2_log_info(rtb->log, NGTCP2_LOG_EVENT_LDC,
- "removing stale lost pkn=%" PRId64, ent->hd.pkt_num);
+ ngtcp2_log_infof(rtb->log, NGTCP2_LOG_EVENT_LDC,
+ "removing stale lost pkn=%" PRId64, ent->hd.pkt_num);
--rtb->num_lost_pkts;
@@ -1398,9 +1403,9 @@ int ngtcp2_rtb_reclaim_on_retry(ngtcp2_rtb *rtb, ngtcp2_conn *conn,
assert(!(ent->flags & NGTCP2_RTB_ENTRY_FLAG_PMTUD_PROBE));
if (ent->flags & NGTCP2_RTB_ENTRY_FLAG_PTO_RECLAIMED) {
- ngtcp2_log_info(rtb->log, NGTCP2_LOG_EVENT_LDC,
- "pkn=%" PRId64 " has already been reclaimed on PTO",
- ent->hd.pkt_num);
+ ngtcp2_log_infof(rtb->log, NGTCP2_LOG_EVENT_LDC,
+ "pkn=%" PRId64 " has already been reclaimed on PTO",
+ ent->hd.pkt_num);
continue;
}
diff --git a/contrib/libs/ngtcp2/ya.make b/contrib/libs/ngtcp2/ya.make
index 4d4b5371037..e63e57d95de 100644
--- a/contrib/libs/ngtcp2/ya.make
+++ b/contrib/libs/ngtcp2/ya.make
@@ -2,9 +2,9 @@
LIBRARY()
-VERSION(1.15.1)
+VERSION(1.16.0)
-ORIGINAL_SOURCE(https://github.com/ngtcp2/ngtcp2/releases/download/v1.15.1/ngtcp2-1.15.1.tar.xz)
+ORIGINAL_SOURCE(https://github.com/ngtcp2/ngtcp2/releases/download/v1.16.0/ngtcp2-1.16.0.tar.xz)
LICENSE(
"(Apache-2.0 OR MIT)" AND
@@ -41,6 +41,7 @@ SRCS(
lib/ngtcp2_cc.c
lib/ngtcp2_cid.c
lib/ngtcp2_conn.c
+ lib/ngtcp2_conn_info.c
lib/ngtcp2_conv.c
lib/ngtcp2_crypto.c
lib/ngtcp2_dcidtr.c