Commit Graph

3653 Commits

Author SHA1 Message Date
Dirkjan Ochtman 7b7bab6b72 Add note about MSRV policy 2021-01-25 13:45:57 -08:00
Dirkjan Ochtman 0a07eaba20 quinn-proto: let Assembler take responsibility for reads from stopped streams 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman f569495b71 quinn-proto: rename read_chunk() to read() 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman ab98859756 quinn-proto: remove read() methods in favor of read_chunk() 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman f2d01fb2ad quinn-proto: check for stopped assembler before reading data
I'm guessing these were missed when these new methods were added,
and it seems like they do present a bit of a layering violation.
2021-01-25 13:27:52 -08:00
Dirkjan Ochtman 7947ad5854 quinn-proto: split connection::streams::types into send and recv modules 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman 6ce0ef2542 quinn-proto: split streams module up 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman 6e9db53d14 quinn-proto: rename Assembler::read_chunk() to read() 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman 6a58b3f542 quinn: remove unused field RecvStream::any_data_read 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman 0439ec5298 quinn-proto: remove slice-based read API from Assembler 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman 0654eb254e Forward max_length argument from high-level API 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman ce67167968 quinn-proto: add max_length argument to Assembler::read_chunk() 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman 72e0f9aa5a quinn-proto: read crypto stream as bytes 2021-01-25 13:27:52 -08:00
Dirkjan Ochtman 2f0dc868d7 Drop periods from bullet list sentence fragments 2021-01-25 01:08:02 -08:00
Dirkjan Ochtman 5bedbbf666 Set up MSRV in CI (fixes #979) 2021-01-25 01:08:02 -08:00
Dirkjan Ochtman ac029a55d9 Fix compatibility with MSRV 2021-01-25 01:08:02 -08:00
Dirkjan Ochtman 51685fb760 Upgrade to tokio 1, bytes 1 and rustls 0.19 2021-01-25 08:53:00 +01:00
Dirkjan Ochtman 22fa31d571 quinn: move UdpExt functionality into platform-specific UdpSocket types 2021-01-25 08:53:00 +01:00
Dirkjan Ochtman 3dddfca8ff Simplify error propagation for ReadExact 2021-01-25 08:53:00 +01:00
Dirkjan Ochtman 395dff32be Simplify interface for scan_ack_blocks() 2021-01-25 08:53:00 +01:00
Dirkjan Ochtman 0dd5537e25 quinn-h3: change 4-tuple to a struct 2021-01-25 08:53:00 +01:00
Dirkjan Ochtman 889d2b3e03 quinn-h3: improve trace output 2021-01-25 08:53:00 +01:00
Dirkjan Ochtman 6de0b470be quinn-h3: fix typo in example function name 2021-01-25 08:53:00 +01:00
Dirkjan Ochtman 6bbea44fb5 quinn-h3: reduce rightward drift in RecvUni Future impl 2021-01-25 08:53:00 +01:00
Dirkjan Ochtman 661884f1ca quinn-h3: enable client-side key logging in tests 2021-01-25 08:53:00 +01:00
Dirkjan Ochtman 48a3213f74 quinn-h3: copy tracing subscriber setup from quinn 2021-01-25 08:53:00 +01:00
Dirkjan Ochtman ea81e654da quinn-h3: clarify error message for closed control stream 2021-01-25 08:53:00 +01:00
Benjamin Saunders 01b55384eb Increase stream concurrency limits to suit new semantics 2021-01-22 11:39:00 -08:00
Benjamin Saunders 1e5a538221 Limit concurrent streams rather than accept queue size
Previously, we limited the number of streams that could be opened by
the peer but not `accept`ed by the application. However, to guarantee
bounded resource use, applications will typically want to limit the
number of streams they process concurrently. While this could
be *approximately* implemented at the application layer by controlling
calls to accept, that approach has a significant drawback: If streams
are slow to process, the worst-case per-stream latency observed by a
peer who opens the maximum number of streams can be arbitrarily bad,
because streams may be opened above the limit the local application is
willing to process. Reducing the number of unaccepted streams
tolerated can reduce the proportion of streams affected, but reducing
it too low will increase the number of round trips required to open
any given number of streams, increasing average latency significantly.

As a side benefit, this reduces the effort needed for applications to
limit concurrency to a fixed quantity, which is expected to be the
overwhelmingly common case. Should a use case for dynamic concurrency
limits arise, we can expose a setter.
2021-01-22 11:39:00 -08:00
Benjamin Saunders f4b3fc15ef Copy default flow control parameters into Streams
Saves passing TransportParameters in all over the place.
2021-01-22 11:39:00 -08:00
Benjamin Saunders 58840bed5c Cosmetic tweak 2021-01-22 11:39:00 -08:00
Benjamin Saunders fe0adf7d4a Reset send_streams counter when 0-RTT is rejected 2021-01-22 11:39:00 -08:00
Benjamin Saunders a37efdaa82 Centralize connection state updates due to stream state discard 2021-01-22 11:39:00 -08:00
Matthias Einwag 8610179063 Derive pacing capacity from window and time
The pacer's behavior currently makes the library extremely inefficient.
Each `Pacer::delay` call would only allow a single
datagram to be sent, and then instruct the connection to wait a tiny
time-slice (which is far smaller than the timer granularity). When the timer
really elapses (e.g. a tokio timer after 1ms) only 1 packet can be sent
again.

This change improves on this by deriving the pacer capacity based on
how big bursts should be, and how much delay we want to have between
those. A pacer delay bigger than timer granularity is desirable for
efficiency and performance reasons. Here 2ms had been chosen, which
had proven effective in tests with an injected RTT.
2021-01-22 19:16:50 +01:00
Matthias Einwag 728fdb9b61 Reset pacing timer
The pacing implementation did so far not do anything. The reason for
that is the timestamp when tokens had been last generated was never
updated. Therefore each Pacer::delay call where not enough tokens
had been available calculated tokens based on the time back to when
the Pacer was initially created, which fully refills the capacity.

This is easily fixed by storing the timestamp when tokens are replenished.
2021-01-22 19:16:50 +01:00
Matthias Einwag 49e57a2f41 Use all tokens for pacing
There is no need for leaving the last token inside the bucket unused.
2021-01-22 19:16:50 +01:00
Matthias Einwag c07201d765 Use correct RTT for pacing
Pacing should make use of the more stable "smoothed" RTT instead
of the last observed RTT, to prevent sudden changes in packet emission.
2021-01-22 19:16:50 +01:00
Matthias Einwag bcbb58fe1b Fix StreamAssembler panic/underflow
The variable `defragmented` wasn't properly updated in the
`read_chunks` method, since it directly manipulated the map instead
of delegating to the `Assembler::pop` method. This caused an underflow
when trying to insert more data into the map.

This change fixes that, and adds a repro test for it.

Fixes #982
2021-01-22 08:01:47 +01:00
Matthias Einwag 4f8a5ebaf1 Non contiguous Send buffer
During testing with a multithreaded runtime I discovered that threads
block a fair amount of time on Mutexes, even though everything in the
state machine should be non-blocking.

By inserting some more timing checks I discovered that the `poll_write`
call took more than 10ms and locked the Mutex for this duration. This
happened due to the `BytesMut::extend_from_slice` taking this time.

The reason here is that extending the buffer require a reallocation of
the buffer and a copy of the complete data. This can be a big size
(up the maximum internal buffer size) - even if only a tiny chunk of
data is added.

This change improves on this by using a non-contiguous send buffer.
New data is appended as a new `Bytes` segment, which only requires
an allocation for this particular size. The 10ms blocking problem is
gone with this.

Another benefit of this change is that it can easily enable zero-copy
writes by accepting `Bytes` as a parameter in the user-facing API.
This is however not performed here yet.

```
Jan 18 11:14:00.064  WARN quinn_proto::connection::send_buffer: self.unacked.extend_from_slice(data[..1048576]) took 10.3452ms. Now unacked size: 94924462
Jan 18 11:14:00.064  WARN quinn_proto::connection::streams: Long Send::write. Total: 10.3943ms, Budget check: 0ns, data_len: 1048576, written: 1048576
Jan 18 11:14:00.064  WARN quinn_proto::connection::streams: Long Streams::write. Total: 10.4203ms, Limit check: 100ns, Unsent check: 200ns, Write: 10.4202ms. data_len: 1048576, written: 1048576
Jan 18 11:14:00.064  WARN quinn::streams: Long poll_write time: close_check 100ns, write_time 10.4456ms, end_time 10.4456ms
```
2021-01-20 09:38:27 +01:00
Matthias Einwag b2d09655c2 Ignore ACKs of data which is no longer tracked
If an a range is acknowledged where a part of it had been previously
acknowledged - ignore the acknowledged range. While the
retransmission logic guarantees this property at the moment, it
might not always hold true.
2021-01-20 09:38:27 +01:00
Matthias Einwag 6f1687c5fb Fix bulk benchmark
The sending data on the benchmark failed it panicked due
to an unwrap and thereby showed no result. This propagates
the first client-side error instead of panicking - which will also
preserve the statistics.
2021-01-19 08:16:47 +01:00
Timon Post 6faa5a3ba9 round 3 2021-01-18 09:30:32 +01:00
Timon f6f832687f Update docs/book/src/quinn/certificate.md
Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2021-01-18 09:30:32 +01:00
Timon d13d9e9c66 Update docs/book/src/quinn/certificate.md
Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2021-01-18 09:30:32 +01:00
Timon 4da254e7b8 Update docs/book/src/quinn/certificate.md
Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2021-01-18 09:30:32 +01:00
Timon 1ff316178c Update docs/book/src/quinn/certificate.md
Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2021-01-18 09:30:32 +01:00
Timon 9eb3819528 Update docs/book/src/quinn/certificate.md
Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2021-01-18 09:30:32 +01:00
Timon 46a96049ba Update docs/book/src/quinn/certificate.md
Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2021-01-18 09:30:32 +01:00
Timon edec8ea9d5 Update docs/book/src/quinn/certificate.md
Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2021-01-18 09:30:32 +01:00
Timon 08e26ce3fd Update docs/book/src/quinn/certificate.md
Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2021-01-18 09:30:32 +01:00