Commit Graph

1721 Commits

Author SHA1 Message Date
Marten Seemann
03a99447fd ackhandler: fix qlogging of alarm timer expiration time (#5363) 2025-10-09 10:21:06 +02:00
Marten Seemann
c2131eb595 qlog: split serializiation and event definitions, remove logging abstraction (#5356)
* qlog: implement a Trace and a Writer struct

* qlog: rename Trace to FileSeq

* split qlog trace writer and QUIC qlog events into separate packages

* use the new qlog.Recorder instead of the logging.ConnectionTracer
2025-10-08 05:53:02 +02:00
Marten Seemann
7c1ce0efe2 ackhandler: track lost packets and detect spurious losses (#5355)
* ackhandler: implement a lost packet tracker

* logging: add ConnectionTracer.DetectedSpuriousLoss event

* ackhandler: detect spurious losses

* qlog: add support for logging spurious packet loss

* ackhandler: delete lost packets after detecting spurios loss

* guard against slice index underflow
2025-10-03 09:59:50 +02:00
Marten Seemann
f607ef489f protocol: optimize ConnectionID.String (#5351)
This function is used by qlog, so it should be fast.
2025-10-03 14:27:39 +08:00
Marten Seemann
2ac3b16df4 improve connection timer logic (#5339)
* simplify timer resets

As of Go 1.23, timer resets work as expected, and there’s no need to
read a (potentially) stale value from the timer channel.

* don't save the last time

* track if blocked

* remove unblock after sendingScheduled

* fix unblock logic when sending

* don't use fallthrough

* track the blocking mode

* remove stale comment
2025-09-24 10:43:01 +02:00
Marten Seemann
adc13be540 implement a memory-optimized time.Time replacement (#5334)
* implement a memory-optimized time.Time replacement

* monotime: properly handle systems with bad timer resolution (Windows)

* monotime: simplify Since
2025-09-14 08:12:10 +02:00
Marten Seemann
f61188b8ff ackhandler: add a benchmark for sending and acknowledging packets (#5333)
* ackhandler: add a benchmark for sending and acknowledging packets

* report allocs, improve benchmark names
2025-09-14 07:00:13 +02:00
Marten Seemann
357f679072 ackhandler: store the last four skipped packets (#5322)
This allows for more accurate packet number difference calculations,
which is especially important once we attempt to detect spurious loss
detection events.
2025-08-30 08:05:59 +02:00
Marten Seemann
0bef51ec76 ackhandler: account for skipped packets in packet threshold calculation (#5316) 2025-08-29 05:39:41 +02:00
Marten Seemann
9cd98f48bf ackhandler: store skipped packet numbers separately (#5314) 2025-08-29 05:09:46 +02:00
Marten Seemann
5bb2146b47 ackhandler: avoid storing packet number in packet struct (#5312)
* ackhandler: optimize memory layout of packet struct

The packet number can be derived from the position that this packet is
stored at in the packets slice in the sent packet history. There is no
need to store the packet number, saving 8 bytes per packet.

* ackhandler: avoid copying the packet struct
2025-08-29 04:18:45 +02:00
Marten Seemann
c8e7cd66e3 ackhandler: immediately clear ackedPacket slice after processing ACK (#5313)
* ackhandler: immediately clear ackedPacket slice after processing ACK

* ackhandler: add defensive check for empty ackedPackets slice
2025-08-28 16:12:20 +02:00
Marten Seemann
168889f283 ackhandler: use a typed mock for the ECNHandler (#5311)
No functional change expected.
2025-08-28 13:39:42 +02:00
Marten Seemann
0cd4bd940b ackhandler: use an iterator to process received packet ranges (#5309)
* ackhandler: use an interator to track received packet ranges

* use slices.Collect

* naming convention
2025-08-28 10:32:26 +02:00
Marten Seemann
cead8cfbd6 ackhandler: fix resetting of packet.isPathProbePacket (#5310) 2025-08-28 10:18:49 +02:00
Marten Seemann
7f98a8b7ca utils: use synctest to make the timer tests fully deterministic (#5306)
* utils: use synctest to make the timer tests fully deterministic

* Go 1.24 workaround
2025-08-25 09:25:50 +02:00
Marten Seemann
258d6b1352 use synctest to make streams map tests fully deterministic (#5296)
* use synctest to make streams map tests fully deterministic

* ignore synctest helper package for code coverage
2025-08-23 18:11:59 +02:00
Marten Seemann
257281b6e2 use synctest to make receive stream tests fully deterministc (#5291) 2025-08-20 09:44:19 +02:00
Marten Seemann
8c062ae604 use testing.B.Loop in all benchmark tests (#5285)
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -category=bloop -fix -test ./...
was used as a starting point.
2025-08-16 12:44:56 +02:00
Marten Seemann
66e5c5ebaa replace interface{} with any (#5290)
No functional change expected.
2025-08-16 07:21:18 +02:00
Marten Seemann
fea19fc3ec update to Go 1.25, drop Go 1.23, use go tool for gomock (#5283)
* update to Go 1.25, drop support for Go 1.23

* ci: update golangci-lint to v2.4.0

* use new go tool command for gomock / mockgen

* also update Go version used for oss-fuzz
2025-08-16 06:14:01 +02:00
Marten Seemann
fee90a89ef ackhandler: generalize check for missing packets below threshold (#5260)
* ackhandler: check for missing packets below reordering treshold

No functional change expected.

With the Acknowledgement Frequency extension, the reordering threshold
will become configurable. With this change, it will be easy to use the
peer-requested value instead of the predefined constant.

* improve documentation

* call HighestMissingUpTo in randomized test
2025-08-14 16:51:24 +02:00
Marten Seemann
da27fcf33f expose basic connection stats via Conn.ConnectionStats (#5281)
* Add ConnectionStats

* remove for loop

* Add comments

* Update comments

---------

Co-authored-by: Marco Munizaga <git@marcopolo.io>
2025-08-13 16:45:14 +02:00
Marten Seemann
5422e4c68c ackhandler: remove unused time from receivedPacketHandler.ReceivedPacket (#5277)
* ackhandler: remove unused time from receivedPacketHandler.ReceivedPacket

No functional change expected.

* fix typo

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* also fix typo in tests

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-05 06:03:02 +02:00
Marten Seemann
0a22da7e03 wire: add support for the min_ack_delay transport parameter (#5266)
* wire: implement parsing and writing of the min_ack_delay transport parameter

* wire: validate the min_ack_delay transport parameter
2025-07-24 15:43:34 +02:00
Marten Seemann
b69abbaf11 wire: implement parsing and writing of the IMMEDIATE_ACK frame (#5265) 2025-07-21 15:56:04 +02:00
Marten Seemann
06e31852cb wire: implement parsing and writing of the ACK_FREQUENCY frame (#5264)
* implement parsing and writing of the ACK_FREQUENCY frame

* prevent overflows of Request Max Ack Delay

* fix fuzzer
2025-07-21 15:35:06 +02:00
Jannis Seemann
c2e784aaf2 wire: optimize parsing logic for STREAM, DATAGRAM and ACK frames (#5227)
ParseOtherFrames-16       148ns ± 4%     150ns ± 3%     ~     (p=0.223 n=8+8)
ParseAckFrame-16          302ns ± 2%     298ns ± 3%     ~     (p=0.246 n=8+8)
ParseStreamFrame-16       262ns ± 3%     213ns ± 2%  -18.61%  (p=0.000 n=8+8)
ParseDatagramFrame-16     561ns ± 5%     547ns ± 4%     ~     (p=0.105 n=8+8)
2025-07-20 13:14:38 +02:00
Jannis Seemann
893a5941fb wire: improve frame parsing benchmarks (#5263)
* Add master-style frame handling benchmarks using type switches

* Fixing styling issue.

* put STREAM frame back

* remove BenchmarkParseStreamAndACK

* use random data for STREAM and DATAGRAM

* improve comment

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-07-18 18:33:04 +02:00
Marten Seemann
92aa7b41d5 handshake: store key update interval in an atomic (#5234)
* handshake: store key update interval in an atomic

We recently changed the way the key update interval is set in tests to
use an environment variable. This resolved a race condition that existed
in the earlier logic, however, parsing of the environment variable now
shows up in benchmark tests.

Using an atomic variable should have a negligible performance impact.

* use an atomic swap
2025-06-21 12:14:07 +02:00
Marten Seemann
d33d293fd2 ci: enable the usetesting linter (#5222)
This linter is useful to detect the creation of temporary directories
and the setting of environment variables in tests.
2025-06-11 09:39:07 +02:00
Marten Seemann
aa22706d78 ci: enable the nolintlint linter (#5221)
This linter helps us find unneeded nolint statements.
2025-06-11 06:52:21 +02:00
Marten Seemann
4f23ac2752 remove connection flow controller mock (#5213)
No functional change expected.
2025-06-09 09:26:23 +02:00
Marten Seemann
576aa1747f simplify stream ID handling in the incoming streams map (#5207)
* simplify stream ID handling in the incoming streams map

No functional change expected.

* protocol: move stream ID constant definition
2025-06-08 12:25:36 +02:00
Marten Seemann
f41858edc9 mocks: simplify mockgen command to generate MockCryptoSetup (#5197)
No functional change expected.
2025-06-07 06:49:49 +02:00
Marten Seemann
3eb8a134cb congestion: migrate tests away from Ginkgo (#5193) 2025-06-01 09:52:47 +02:00
Marten Seemann
488ba91262 ackhandler: migrate the ECN tests away from Ginkgo (#5084) 2025-06-01 06:40:58 +02:00
Marten Seemann
4dd059522f mockquic: remove package (#5171) 2025-05-30 08:10:16 +02:00
Marten Seemann
5d7ee61f5f wire: add support for the reset_stream_at transport parameter (#5158) 2025-05-28 06:30:02 +02:00
Marten Seemann
cb5c3f2aad implement parsing and writing of RESET_STREAM_AT frames (#5155)
* implement parsing and writing of RESET_STREAM_AT frames

* wire: add support for parsing RESET_STREAM_AT frames
2025-05-28 05:49:54 +02:00
Ameame
8ef0a71581 store the RTT in the token, not in the session ticket (#5065)
* remove RTT from session ticket

* save RTT in token

* use mus as rtt unit in token

* move RTT from session state to token on client side

* Rename the rtt variables

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* Update internal/handshake/token_generator.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* Update token_generator.go

* Update connection.go

* Update token_generator.go

* correct slice  access in fuzz.go

* rearrange connection constructor parameters

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-05-16 12:25:58 +02:00
Marten Seemann
8474eddd3a use the slices package to simply QUIC version comparisons (#5130)
No functional change expected.
2025-05-09 06:24:45 +02:00
Marten Seemann
cfc6c16f36 fix race condition in tests when setting the key update interval (#5121)
* fix race conditions in tests when setting the key update interval

* remove test for running transports and handshakes
2025-05-06 04:45:27 +02:00
Marten Seemann
9b3ff059fc delete closed connections after 3 PTOs (#5117)
In most cases, this should be earlier than the current
timeout value of 5s.
2025-05-04 12:51:39 +02:00
Marten Seemann
597fee0b34 ackhandler: migrate the packet number generator tests away from Ginkgo (#5081) 2025-04-27 11:27:28 +02:00
Marten Seemann
b3f55bb7b7 use assert.AnError consistently in tests (#5066)
No functional change expected.
2025-04-21 03:52:08 +02:00
Marten Seemann
d35b5ac187 use ed25519 instead of RSA in tests and examples (#5050)
Also adds a golangci-lint depguard rules that forbids
importing crypto/rsa.
2025-04-20 05:55:08 +02:00
Marten Seemann
7548cc069a protocol: fix flaky TestVersionGreasing (#5051) 2025-04-19 10:19:00 +02:00
Marten Seemann
267cca773b switch from math/rand to math/rand/v2 (#5045)
* switch from math/rand to math/rand/v2

* switch away from golang.org/x/exp/rand
2025-04-19 09:01:22 +02:00
Marten Seemann
0894931c64 protocol: use math/rand/v2 to generate greased versions (#5046) 2025-04-14 14:30:04 +02:00