-
Notifications
You must be signed in to change notification settings - Fork 26
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
Session ID of each connection from one host is not unique #25
Comments
Nice :)
Not really. WebTransport Session ID is not intended to be used as a discriminator for client connections. In other words, you cannot use the WebTransport session ID to uniquely identify a connection or a client origin.
I'm sorry, but I believe you may have misunderstood. Please let me try to clarify on this. The draft states that a Session ID uniquely identifies a WebTransport session within the same connection. In other words, with a single connection, you might have multiple sessions, and each of them has a different Session ID. Different connections (even if the two connections come from the same endpoint/client) do not have any correlation with session ID numbers. Having said that, I might add a few considerations that could be useful in your use case. As I understand it, you are attempting to create a map of connections. In this regard, I would advise not to use the remote address of the peer as an index key. In QUIC (RFC 9000, section 9), an endpoint has the ability to change its network address and perform a migration. Since WebTransport is built on top of QUIC, it might also support connection migration. In your use case, the client might change its network address while the index of the map remains the same, resulting in inconsistency. Please refer to the documentation: https://docs.rs/wtransport/latest/wtransport/struct.Connection.html#method.remote_address
In conclusion, I am thinking two possible action items for now:
Do you think that having something like:
Thanks |
That makes a lot of sense I appreciate the clear up, it appears my understanding of the SessionId was incorrect. For my usecase it seems you are correct, I must stop using the remote address of the client as the index key of the connection map due to the QUIC connection migration. I did see the notice in the docs for the method you linked I just needed something for a proof of concept A library provided unique identifier for each connection like the stable_id and an interface in the configuration to disable connection migration would indeed be immensely helpful. I will try to support QUIC connection migration (since it actually seems pretty useful) instead of outright disabling it but for prototype purposes that would be awesome. I put up a PR for number 2 here which exposes a couple more helpful methods for my use case alongside the stable_id, feel free to suggest revisions. I don't know how to do number 1 cleanly, in that the way I would do it, is just a method argument for one of the ServerConfigBuilder methods to avoid decoupling the ClientConfigBuilder and ServerConfigBuilder state tracking Generic structs. If you can provide some guidance I can do number 1 too EDIT: Updated source code reference using new stable_id as hashmap keys https://gist.github.com/JustSomeDude301/86226921eaa3b0edbf94c45f40724e28 Connection 1
Connection 2
|
Thank you for the contribution. Regarding the configuration setting, I opened this PR: #28 If I may, I would like to add a further consideration regarding your use case. Using However, I am curious as to why you cannot simply utilize an internal incremental counter for your map-keys. For instance, you can refer to the example in this crate: https://github.com/BiagioFesta/wtransport/blob/master/wtransport/examples/server.rs#L28-L31 In the example, an incremental ID is assigned (primarily for logging purposes) to each incoming connection. This approach is generally simpler and does not rely on an internal ID implementation. |
Thanks man I really appreciate the fast turnaround on the migration config!
I could, but if there's a valid identifier exposed by the library I'm generally more inclined to just use that than roll my own. This is pretty much just semantics so whatever you wanna do for this is totally fine by me. Thank you again for clearing up my misunderstandings about how sessions and migration work! EDIT: I've elected to go with a UUID for the connection key in my hashmap, I can remove the stable_id() method from PR #26 if you'd like. The max_datagram_size() and rtt() methods would still be beneficial to my usecase |
I think your PR is fine like that and I already merged. My concern was strictly for your use case, not for avoiding having |
Closing this issue as solved |
Source Code Reference: https://gist.github.com/JustSomeDude301/9803efa298a46b6b55015f69a98b0e01
Filing this moreso for information. Is this behavior intentional?
I am using a concurrent hashmap implementation (DashMap) for storing the Connection objects. Currently the Key I use for each connection is the remote address of the connection. But if this is intentional and each Connection with an identical SessionId should be treated as one pooled "Connection" I may have to rethink my approach.
When making multiple connections from localhost each one has a unique remote address, however the SessionId is identical:
Connection 1:
Connection 2:
The IETF Draft says:
The way I am interpreting this is that two unique Connections from the same host will have unique SessionId's, but feel free to correct my understanding
BTW I love the library, I am using it to make a Datagram server framework intended for porting UDP Multiplayer Netcode libraries
The text was updated successfully, but these errors were encountered: