* congestion: prevent uint64 overflow in pacer
This should never happen for bandwidths even remotely possible in
real-world scenarios, but it’s better to be safe.
* congestion: add a benchmark test for the pacer
* add a comment
* utils: initialize the {Smoothed, Latest, Min}RTT to 100ms
* utils: use time.Duration.Nanoseconds instead of uint64
No functional change expected.
* congestion: better check to avoid division by zero
This is needed for events such as recovery:loss_timer_updated, which
contain the timer expiration timestamp encoded as a difference from the
event time.
* 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
* qlog: use fork of encoding/json/jsontext instead of unmaintained gojay
* implement a minimal jsontext-compatible encoder
* qlogtext: improve fuzz test
* qlog: simplify JSON encoding error handling
* qlog: make use of jsontext.Bool
* 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
* 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
* implement a memory-optimized time.Time replacement
* monotime: properly handle systems with bad timer resolution (Windows)
* monotime: simplify Since
* fix: return stream frames to pool on error paths
fixes potential memory leak where StreamFrames were not returned to
sync.Pool in error/cancellation paths.
root cause: frames are llocated via GetStreamFrame() but never returned
via PutBack() when streams enter terminal states without going through
normal OnAcked() cleanup.
fixed paths:
- CancelWrite(): return frames when reliableOffset == 0
- handleStopSendingFrame(): return frames on STOP_SENDING
- closeForShutdown(): return frames on connection shutdown
- OnLost(): return frame when stream reset with no data sent
* fix: clear slice before nil assignment, remove excessive tests
- add clear() call to properly release GC references per https://github.com/quic-go/quic-go/pull/5327#discussion_r2328451862
- remove excessive pool return tests per https://github.com/quic-go/quic-go/pull/5327#discussion_r2328453227
* do not allow use a closed transport
* update tests
* add test
* Update http3/transport.go
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* unit tests
* update test
---------
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
This allows for more accurate packet number difference calculations,
which is especially important once we attempt to detect spurious loss
detection events.
* 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