Commit Graph

2620 Commits

Author SHA1 Message Date
Benjamin Saunders 5bd7e4b95e Permit adding connections while endpoint internals are borrowed 2020-11-09 08:04:01 +01:00
Benjamin Saunders 6dbdacd481 Extend UDP API to permit batched recv 2020-11-09 08:04:01 +01:00
Benjamin Saunders f17eeca4fa Print rate in standalone bulk benchmark 2020-11-09 08:04:01 +01:00
Matthias Einwag c65a83670e Packet reception stats
This adds the same set of stats for received datagrams
that have been merged previously for transmitted datagrams.
2020-11-08 22:52:31 +01:00
Matthias Einwag bbb310556a Recreate timers less often
With the current timer setup, Quinn destroys a tokio timer each time
the timer is disabled, and recreates it when a timeout is required again.
This has a certain attached cost, since timer creation requires a memory
allocation, and both creating the timer as well as resetting and polling
it incur some synchronization costs.

With this change, we keep one timer around and reuse it - which saves
some of these costs.

In addition to this, the change checks the connection first on whether
a timer is still required before polling the timeout. This can remove
some unnecessary wakeups.
2020-11-07 23:13:52 +01:00
liwenjieQu d2c18116a2 Bug Fix when accepting and retiring connection ID (#871)
Co-authored-by: Wenjie Li <liwenji@amazon.com>
Co-authored-by: Benjamin Saunders <ben.e.saunders@gmail.com>
Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2020-11-07 20:40:57 +01:00
Matthias Einwag 0588ebf6fb Add connection level statistics
This change adds some structs which track connection-level statistics.
These are rather helpful to determine how the implementation performs,
and which impact certain changes have.

The implementation is not complete. It's just a first step on getting
some more visibility into the transmitting side of the library. More
statistics - e.g. around congestion control, retransmission, timing, etc
could be added.

The stats are currently private, and I just debug printed them so far
where found useful. They could however be public if the API is fine.
Another possibility is to have the stats behind a feature flag if people
are concerned about extra memory usage.
2020-11-06 21:19:35 +01:00
Matthias Einwag be4a0dccc8 Send only significant MAX_STREAM_DATA updates
The current version of Quinn tries to enqueue a MAX_STREAM_DATA
update after every read from the stream. Those could potentially be
tiny. Besides wasting network capacity with sending tiny packets, that
behavior also causes a wakeup on the connection task.

This change triggers MAX_STREAM_DATA frames only to be enqueued
if they are deemed significant enough. In the version here, this means
is bound to 12.5% of the overall window - but this could be changed.

Note that the general connection task wakeup after reads is still there.
A similar change would need to be performed for updating the
connection window, in order to determine whether the connection task
wakeup is still necessary.

I gathered some example metrics for the amount and increment of window
updates in the benchmark:

Before:
Num max stream announcements: 1663, Total window announced: 58500130, Avg window diff: 35177

After:
Num max stream announcements: 301, Total window announced: 58195055, Avg window diff: 193339

==> This sends 5x less window updates
2020-11-06 19:46:13 +01:00
Jasen Borisov 1ea0b897fa Add Connection::rtt method
Give users access to our RTT/latency estimate.
2020-11-05 14:05:50 -08:00
Timon a2a02c745e Readme update (#866) 2020-11-05 09:44:44 +01:00
Matthias Einwag bd14aa1dc2 Update add_read_credits parameter name to transmit_max_stream_data
It wasn't super clear what `more` means here. The purpose of this
parameter is to signal whether a `MAX_STREAM_DATA` frame needs to be
sent. This change tries to improve that.
2020-10-31 19:17:07 -07:00
Benjamin Saunders 79e5bdc141 Support peers on drafts 29 through 32 inclusive 2020-10-31 14:12:25 -07:00
Benjamin Saunders e3b05a9d88 Style tweak 2020-10-31 14:12:25 -07:00
Benjamin Saunders 7ef6782888 Pad packets containing PATH_CHALLENGE and PATH_RESPONSE 2020-10-31 14:12:25 -07:00
Benjamin Saunders c31c22b241 Move max_streams transport parameter sanity checks out of Connection 2020-10-31 14:12:25 -07:00
Benjamin Saunders 5cb959793d Draft 32 packet protection limits 2020-10-31 14:12:25 -07:00
Matthias Einwag 4c9c0dc3c6 Use vectors instead of boxed slices
Use vectors instead of boxed slices

The conversion from Vec<u8> into Box<[u8]> is not always for free.
It will call `Vec::into_boxed_slice`, which will call `shrink_to_fit`.
https://github.com/rust-lang/rust/blob/28f03ac4c08fc7ec62428d0b914e1510ce7ee2cb/library/alloc/src/vec.rs#L689

If the `Vec` isn't fully utilized before, this will cause a reallocation
and a copy of all data. This might currently happen with every
outgoing packet.

This change simply keeps things as `Vec<u8>`, which works just fine since
the IO layer can deal with it.
2020-10-31 10:27:00 -07:00
Dirkjan Ochtman d1e536665b Add some more error conveniences 2020-10-29 10:45:50 -07:00
Dirkjan Ochtman 1bca0f7c2a Switch from err-derive to thiserror
thiserror is easier to use, has fewer dependencies and is more popular.
2020-10-29 10:45:50 -07:00
Dirkjan Ochtman 766d20a592 proto: rename UnsupportedVersion fields 2020-10-29 10:45:50 -07:00
Benjamin Saunders f67fd95df8 Remove dead code
This dates from when connection drivers were external.
2020-10-24 14:25:40 +02:00
Benjamin Saunders 134ff4c294 Warn about platform dual-stack socket behavior variances
This has bitten at least 3 users.
2020-10-16 07:00:20 +02:00
Dirkjan Ochtman 1e7095941e quinn-proto: remove RetryToken TODO comment 2020-10-12 12:13:50 -07:00
Dirkjan Ochtman 84ba340697 quinn-proto: improve grouping in RetryToken impl 2020-10-12 12:13:50 -07:00
Dirkjan Ochtman 3f3335e242 quinn-proto: tweak ordering in RetryToken 2020-10-12 12:13:50 -07:00
Dirkjan Ochtman d5b47f601d Unwrap unused results from invalid config values 2020-10-12 12:13:50 -07:00
Dirkjan Ochtman d4ac4057bd interop: remove type length limit after 1.47 release 2020-10-12 12:13:50 -07:00
Dirkjan Ochtman 0630fc95f5 Tweak formatting 2020-10-12 11:29:21 +02:00
Vanshdeep e87346a6d7 Encrypt retry token (fixes #783) 2020-10-12 11:29:21 +02:00
Dirkjan Ochtman ff086b4a2c Use combinator instead of matches!() 2020-10-11 10:43:10 -07:00
Dirkjan Ochtman 012263be28 Implement miscellaneous clippy (1.47) suggestions 2020-10-11 10:43:10 -07:00
Dirkjan Ochtman 5bb0a32cd4 Use matches!() macro where appropriate 2020-10-11 10:43:10 -07:00
Benjamin Saunders 9d3942d272 Default to unlimited connection-level flow control credit
This leaves data flow control to be governed purely at the stream
level by default, removing a surprising footgun for users that need to
tune flow control and who aren't aware of all the knobs.
2020-10-11 14:21:58 +02:00
Benjamin Saunders 19b8d0c447 Represent transport parameters with VarInt pervasively
Moves bounds-checks into the configuration setters, making
misconfiguration errors more user-friendly.
2020-10-11 14:21:58 +02:00
Benjamin Saunders c55843ff83 Restrict Arbitrary VarInts to in-bounds values 2020-10-11 14:21:58 +02:00
Benjamin Saunders 637153970f Fix panic on packet construction with large flow control credit 2020-10-11 14:21:58 +02:00
Benjamin Saunders 0d91abed65 More closely match ID backpressure test to intended behavior 2020-10-11 14:21:58 +02:00
Dirkjan Ochtman a68e18c6e6 Update checkout and cargo-deny GitHub Actions
In particular, this prevents errors from an old cargo-deny version,
which fails to parse recent additions to the advisory database.
2020-10-03 12:39:28 -07:00
Dirkjan Ochtman d79d548a27 Style tweaks from #851 2020-10-03 12:39:28 -07:00
Benjamin Saunders 82cc875900 Gracefully close when impending required key update is impossible 2020-10-03 12:37:52 -07:00
Benjamin Saunders 163eb7b55d Respect AEAD confidentiality limits 2020-10-03 12:37:52 -07:00
Benjamin Saunders 8a3597bc0c Factor out logic to gracelessly kill the connection 2020-10-03 12:37:52 -07:00
Benjamin Saunders dc475d23de Respect AEAD integrity limits 2020-10-03 12:37:52 -07:00
Benjamin Saunders 7ab980589f Define AEAD_LIMIT_REACHED error 2020-10-03 12:37:52 -07:00
liwenjieQu 37a2fde11a Update quinn-proto/src/cid_generator.rs
Co-authored-by: Benjamin Saunders <ben.e.saunders@gmail.com>
2020-10-03 13:29:11 +02:00
Wenjie Li d525ab2fa8 Add lifetime to CID to avoid future change on CID generator trait that breaks compatibility 2020-10-03 13:29:11 +02:00
Wenjie Li 7371765a0d Add doc for cid new function 2020-10-03 13:29:11 +02:00
Wenjie Li 42704b3445 remove pub(crate) from CID new function to allow a third-party crate to implement CID generator 2020-10-03 13:29:11 +02:00
Wenjie Li 62ef887772 Remove validate_cid API from cid generator 2020-10-03 13:29:11 +02:00
Wenjie Li ed913f061f Minor edits 2020-10-03 13:29:11 +02:00