Commit Graph

69 Commits

Author SHA1 Message Date
Benjamin Saunders 612c9ac2b8 Remove unnecessary dropping in client/server examples 2021-01-26 06:46:32 +01: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
Dirkjan Ochtman 17fe82b598 Apply clippy fixes for 1.49 2021-01-01 11:16:05 -08:00
Dirkjan Ochtman 4420b61aaa quinn: print socket addresses in example client/server 2020-12-11 16:17:48 -08:00
Timon 83cff80908 Create example README (#910) 2020-11-15 21:43:28 +01: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 d5b47f601d Unwrap unused results from invalid config values 2020-10-12 12:13:50 -07:00
Dirkjan Ochtman f212256435 Clean up warnings/errors 2020-09-03 09:17:32 -07:00
Dirkjan Ochtman 5484d37c76 Migrate to directories-next
directories is no longer being maintained and the final released version
causes a dependency conflict (cfg-if, versus tracing).
2020-06-22 14:46:13 +02:00
Benjamin Saunders 128c1b2a5e Decouple ClientHello data from peer identity
These are determined at different times for incoming connections, so
bundling them together was fairly ugly.
2020-06-07 14:42:16 +02:00
Jesse Lucas 11a7c77992 Add usage documentation to quinn/examples/server.rs 2020-04-25 18:06:04 +02:00
Dirkjan Ochtman 0a4bca7049 Remove old authentication data APIs 2020-03-07 12:12:01 -08:00
Benjamin Saunders 5774071b48 Spawn driver tasks implicitly 2020-01-13 09:54:26 +01:00
Benjamin Saunders 09729ebd23 Opaque config structs
Only exposing setters improves forwards compatibility and error
checking.
2020-01-13 08:53:05 +01:00
Benjamin Saunders 03cd3e27f2 Correct style for latest rustfmt 2019-12-22 09:30:02 +01:00
daxpedda 7233455078 Update tokio, futures and bytes. (#528) 2019-12-02 10:42:05 +01:00
Benjamin Saunders 4902bfe6ba Use anyhow instead of failure in examples
Anyhow was already in our depgraph and is more modern and actively
maintained.
2019-11-19 11:46:43 -08:00
Benjamin Saunders 93690aa4c9 Fix buggy non-async-style tracing span in server example 2019-11-19 20:01:49 +01:00
Timon Post ac810125c1 merge imports 2019-11-19 08:23:35 +01:00
Benjamin Saunders a957bf4aa2 Replace slog with tracing 2019-10-29 10:36:50 +01:00
Benjamin Saunders 2dcb084347 Decouple incoming streams of differing directionalities 2019-09-29 07:38:30 +02:00
Benjamin Saunders 8e1c6b605e Remove ToSocketAddrs from EndpointBuilder::bind
Improves consistency with Endpoint::connect and removes the
possibility of silent blocking should the user pass in a domain
name. The generic API was originally motivated by the convenience of
passing in numeric addresses as strings, but `.parse().unwrap()` is
pretty easy too.
2019-09-29 07:21:06 +02:00
Benjamin Saunders 82b9455caf Use multithreaded tokio runtime for server example
Illustrates our support for more typical tokio patterns
2019-09-28 10:23:26 +02:00
Benjamin Saunders d07dc907ad Update for async/await 2019-09-28 10:23:26 +02:00
Benjamin Saunders f50dd9f54a Restore NewConnection struct for parts of a connection
This enables forwards-compatibility with future extensions such as
a datagram stream.
2019-08-25 14:50:01 -07:00
Benjamin Saunders e7929713cd Handle unclear interop ALPN 2019-07-11 20:52:19 +02:00
Benjamin Saunders b502306ab3 Refactor ReadToEnd helper to work after reads 2019-07-05 08:35:26 +02:00
Benjamin Saunders 747d5a263b Colorful logging in examples 2019-06-24 19:31:38 +02:00
Benjamin Saunders cf319d562f Helper functions for unwrapping incoming streams of known type 2019-06-24 19:31:38 +02:00
Dirkjan Ochtman 7b507d82b1 Move ALPN_QUIC_HTTP from library to examples/interop code 2019-06-20 12:30:02 -07:00
Dirkjan Ochtman 45ee97bd5a Upgrade to rcgen 0.4 2019-06-18 14:11:40 -07:00
Benjamin Saunders 264904f692 Don't expose 0.5-RTT connections to servers by default
0.5-RTT connections have reduced security guarantees and hence must
only be exposed by opt-in.
2019-04-28 21:13:20 +02:00
Benjamin Saunders dcaa80c170 Define helper future for finishing streams
More convenient than the tokio::io shutdown helper, and preserves
specific error information.
2019-04-27 20:57:19 +02:00
Benjamin Saunders 9eea392e35 Restrict read_to_end to unread streams 2019-04-25 06:46:09 +02:00
Benjamin Saunders 8966c7e2d1 Don't yield stream from ReadToEnd
This was left over from before bidirectional streams were decoupled.
2019-04-25 06:46:09 +02:00
Dirkjan Ochtman 734978e59e Rename quinn::Endpoint::new() to builder() 2019-04-16 17:55:13 -07:00
Dirkjan Ochtman 16e4b96f4b Simplify high-level streams API 2019-04-12 19:59:23 +02:00
Benjamin Saunders 0428c8693d More consistent config filed naming 2019-04-08 07:12:21 +02:00
Benjamin Saunders 7fce27d84a Ignore trailing garbage in HTTP/0.9 example server 2019-04-07 00:34:15 -07:00
Dirkjan Ochtman 0cf709114c Log listening address in example server 2019-04-01 21:06:53 +02:00
Dirkjan Ochtman aae9edecd4 Return new connections as tuples 2019-04-01 10:56:38 +02:00
Dirkjan Ochtman c0c40891b4 Return driver as first member of endpoint tuple 2019-04-01 10:56:38 +02:00
Benjamin Saunders 25d60cca9f Refactor close behavior
Closing the connection is now considered an instantaneous operation,
which causes outstanding I/O futures to fail immediately with a
distinct error and gracefully terminates IncomingStreams and, one
draining has completed, ConnectionDriver.
2019-03-30 16:34:16 -07:00
Dirkjan Ochtman d2f454ebc6 Return Connections from Endpoints after creation 2019-03-27 18:20:24 -07:00
Benjamin Saunders b8e6ff127c Tweak builder method naming
Most builder methods are setters, so this prefix doesn't carry its weight.
2019-01-27 07:19:47 +01:00
Benjamin Saunders 06b4873257 Isolate per-endpoint and per-connection configuration
This makes it easier to speak different application protocols on
different connections using the same endpoint
2019-01-27 07:19:47 +01:00
Benjamin Saunders ef64df4664 Disable unidirectional streams explicitly in server example 2019-01-23 08:35:23 +01:00
Benjamin Saunders e73fadaa6f Support user-supplied DER certificates in the server example
This is the type we generate and cache by default, so it's weird not
to handle it.
2019-01-18 08:08:19 +01:00
Benjamin Saunders 2b96ccee36 Typo fix 2019-01-18 08:08:19 +01:00
Benjamin Saunders 06474e9ee3 Automatic certificate generation in examples 2019-01-10 06:48:20 +01:00