-
-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use BytesMut for Transmit content #1545
Conversation
CI failures seem unrelated |
Would you mind adding a commit that bumps the MSRV to 1.60? |
done |
@djc looks some more dependencies are increasing MSRV |
Can you elaborate on this requirement a bit? quinn-proto is intended to prepare bytes optimally for consumption by the underlying UDP stack.
|
oh no, you are right, that allocates, okay I guess I will have to change this to store |
I have three different types of connections in the background, 1 UDP socket for ip4, 1UDP socket for ip6 and a TCP based relay. Packets are sent dynamically to one of these three, depending on the best available route. |
I thought you only needed to split them up, not duplicate them?
Why does this require splitting anything? |
Sorry I wasn't clear enough. By "Splitting up" I meant that I would need to potentially do different things with each The current operations I have to do concretely are
|
None of those operations obviously involve splitting or cloning the payload. Can you elaborate? |
The signature of
|
Ah, I had assumed you were using quinn-proto, not implementing |
MSRV update is in main now, so a rebase should clean up CI. |
7ea6c28
to
7deafe2
Compare
@Ralith any other thoughts on this? would love to get this in |
7deafe2
to
47205e0
Compare
The implementation here looks good. I'm hesitating because I can't help but wonder if your use case would be better addressed by maintaining separate connections and switching them at the application layer, in which case we could avoid this (admittedly slight) increase in API complexity. Running QUIC over TCP in particular is going to be rather inefficient, and it would be perfectly reasonable to have parallel QUIC connections over IPv4/IPv6; this is basically happy eyeballs. |
I have been wondering that as well, but the biggest obstacle to that that I see currently is that I need to be able to do parallel sends of packets, to reduce latency in connection establishment. Basically I am using the relay transport for the first few packets, while hole punching is running, and switch over as soon as I can, and if I am unsure if my udp addresses are any good I double send packets over both the relay and the udp until I get some kind of confirmation. I don't quite see how I can achieve the same robustness with switching connections at the application layer. |
I'm guessing "the relay" here means the TCP connection? It sounds like you have two separate concerns: latency and robustness. Robustness is easy to achieve with application-layer switching: always send data only on a connection that's been successfully established, sorting by priority (presumably favoring QUIC once available). It sounds like you're also invested in avoiding a superfluous round-trip between hole punching success and QUIC connection establishment. Could you use the actual initial QUIC handshake packet for the hole punching, so that success implies connection establishment? |
That might be possible, but currently we are following an existing design that has proven to work for a similar use case (tailscale to be specific). So while we might be able to optimize things to that at later stage, we will need to make it work like this for the moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. I don't see really see any drawbacks to Bytes
over Vec
given that Bytes
is already in our API, so we might as well support that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dignifiedquire can you give this a rebase? Should be fairly straightforward.
da41e0a
to
742c62d
Compare
done, should be fixed |
okay, MSRV is upset again :( you want me to bump to 1.65? |
I'm working on a fix for the MSRV issue in #1558. |
68b85a2
to
25278c8
Compare
25278c8
to
f3256a9
Compare
Going to merge this, since the MSRV issue will be fixed separately (and FreeBSD CI passes). |
This is a potential solution for my current problem. The issue I am running into, is that I have to split up the
Transmit
s that are sent out, and send them over a channel. but because I only get access to a&[Transmit]
, I have to copy thecontent
buffer.The solution here switches the
Vec<u8>
simply forBytesMut
, which I can then easily send over a channel (and store for potential delayed submission) without copying.One additional change that for convenience I would add, is to derive
Clone
forTransmit
, as now this is an actual cheap operation.