quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

proto: make initial destination cid configurable #1897

Closed thynson closed 3 months ago

thynson commented 3 months ago

This PR implements #1896.

thynson commented 3 months ago

On second thought, should this be a field of ClientConfig? It's only needed for outgoing connections, after all.

I tried but was stuck with the mutability of the ClientConfig. Maybe some interior mutability pattern should applied here. A mutex is required to do so.

I'll find some time to implement a ClientConfig version in a couple of days.

djc commented 3 months ago

On second thought, should this be a field of ClientConfig? It's only needed for outgoing connections, after all.

I tried but was stuck with the mutability of the ClientConfig. ~Maybe some interior mutability pattern should applied here~. A mutex is required to do so.

I'll find some time to implement a ClientConfig version in a couple of days.

Not sure what you mean? EndpointConfig ends up in an Arc inside Endpoint::config, too, so how is the mutability of ClientConfig different/an issue?

thynson commented 3 months ago

On second thought, should this be a field of ClientConfig? It's only needed for outgoing connections, after all.

I tried but was stuck with the mutability of the ClientConfig. ~Maybe some interior mutability pattern should applied here~. A mutex is required to do so. I'll find some time to implement a ClientConfig version in a couple of days.

Not sure what you mean? EndpointConfig ends up in an Arc inside Endpoint::config, too, so how is the mutability of ClientConfig different/an issue?

The EndpointConfig holds an Arc of a factory, when building an Endpoint, an instance of Box<dynConnectionIdGenerator> is obtained from the factory, so the mutability issue is not applied there.

thynson commented 3 months ago

Updated to move it to ClientConfig

thynson commented 3 months ago

Added a commit that replaces ConnectionIdGenerator with function trait instead. It will be squashed if approved.