Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transport): don't pace below timer granularity (mozilla#2035)
* fix(transport): don't pace below timer granularity Neqo assumes a timer granularity of 1ms: https://github.com/mozilla/neqo/blob/0eb9174d7a67b250607f0c3ea056fe056bcf91f5/neqo-transport/src/rtt.rs#L25-L27 but `neqo_transport::Pacer::next()` might return values `< GRANULARITY`. https://github.com/mozilla/neqo/blob/0eb9174d7a67b250607f0c3ea056fe056bcf91f5/neqo-transport/src/pace.rs#L71-L90 Under the assumption that a timer implementation rounds small values up to its granularity (e.g. 1ms), packets can be delayed significantly more than intended by `Pacer`. With this commit `Pacer` does not delay packets that would previously be delayed by less than `GRANULARITY`. The downside is loss in pacing granularity. See also: - google/quiche - https://github.com/google/quiche/blob/60aec87316d24392b2ea37c391ecf406ef183074/quiche/quic/core/congestion_control/pacing_sender.cc#L167 - https://github.com/google/quiche/blob/60aec87316d24392b2ea37c391ecf406ef183074/quiche/quic/core/quic_constants.h#L304 - quic-go - https://github.com/quic-go/quic-go/blob/d1f9af4cc6b13c96dc302ac9ec5f061ed294d36b/internal/protocol/params.go#L137 - `kGranularity` in RFC 9002 https://datatracker.ietf.org/doc/html/rfc9002#name-constants-of-interest * Address suggestions * Add test * Fix path_forwarding_attack test Pacing on new path is now below granularity and thus packet on new path is send immediately. Calling `skip_pacing` will instead fast forward to the PTO of the old path to expire, thus leading to an unexpected probe packet on the old path. ``` thread 'connection::tests::migration::path_forwarding_attack' panicked at test-fixture/src/assertions.rs:153:5: assertion `left == right` failed left: [fe80::1]:443 right: 192.0.2.1:443 ``` This commit simply removes the no longer needed `skip_pacing` step, thus reverting to the previous behavior. * clippy --------- Co-authored-by: Lars Eggert <[email protected]>
- Loading branch information