SwiftQUIC: Provide path events when QUICPath changes or is validated#55
SwiftQUIC: Provide path events when QUICPath changes or is validated#55agnosticdev wants to merge 3 commits into
Conversation
|
Another design consideration for swift-nio-quic is that this change takes into account a defined UDP and IP stack running underneath QUIC. In swift-nio-quic, QUIC sits on top of a UDP socket and so we will need to further enhance this change to know when the clients endpoint has changed there also so we can properly expose an event in this case as well. |
| @available(Network 0.1.0, *) | ||
| public struct QUICPathInfo: Sendable, Equatable { | ||
| public enum PathAddress: Sendable, Equatable { | ||
| case v4(IPv4Address, port: UInt16) |
There was a problem hiding this comment.
Why are these stored as addresses? I think storing as endpoints would be better than forcing it to be its own tuple of address and port.
There was a problem hiding this comment.
Ideally these would be stored as an Endpoint, or as an AddressEndpoint. However those types are not Sendable and QUICPathInfo is required to be Sendable because DomainSpecificNetworkProtocolEvent is Sendable. So I moved it down to the lowest common Sendable type which is an address.
| } | ||
| } | ||
|
|
||
| public func getPathEndpoints( |
There was a problem hiding this comment.
How is this supposed to work when we have multiple underlying paths? Which set is returned?
Also, it would be nice to return a struct type instead of a tuple
There was a problem hiding this comment.
I did switch a struct in the latest changes c42008f. This change does not take into account multiple underlying paths, only the the particular path that going through the events for handlePathChanged and handlePathChallengeResponse callbacks.
There is a need for swift-nio-quic to observe events when
QUICPathchanges or becomes validated. This typically happens during connection migration. It is not appropriate to exposeQUICPathdirectly so this change exposes a new type calledQUICPathInfothat carries local and remote Endpoint information about the new datagram path underneath QUIC when it changes. WhenQUICPathchanges or becomes validatedQUICchecks with the lower protocol (UDP) to obtain the endpoints of the new path below it and sends aQUICEventthat can be observed at the connection level through an object such asNewStreamFlowHarnessand the application level can update needed info based on these events.Design considerations:
QUICPathInfoneeds to beSendablebecauseDomainSpecificNetworkProtocolEventisSendable.Endpointis notSendableand so I had to expose it through a computed property here. That is the need forPathAddressonQUICPathInfo.