Skip to content
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

WebTransport session #1252

Merged
merged 6 commits into from
Nov 25, 2021
Merged

WebTransport session #1252

merged 6 commits into from
Nov 25, 2021

Conversation

ddragana
Copy link
Contributor

@ddragana ddragana commented Oct 8, 2021

This PR creates a generic ExtendedConnectFeature structure that is responsible for a feature negotiation and keeps a HashMap of the extended connect requests. The HashMap will be used for finding active sessions.

An extended connect request will be created as a regular fetch request only the listener for the events will be different. A generic ExtendedConnectSession structure is created for each extended connect request and is responsible for listening to request events and following the state of the request/session, e.g. the session is being negotiated, a stream is closed, etc..This structure will be responsible for bookkeeping, i.e. it will hold information about active streams open on a session and it will make sure to close all streams if the session request is closed.
Currently ExtendedConnectSession cannot read data from the request stream, this will be fixed in a separate PR.
On the server side, upon receiving headers a regular http request will be transformed into an extended connect request and a new ExtendedConnectSession will be set to be the listener for the request.

Regular http request functions will be used for closing an extended connect request, e.g. steam_stop_sending, cancel_fetch, etc.

Additional changes:
Now it is not easily possible to distinguish between Http stream and Push stream, therefore RecvMessage holds the type of the stream.
WebTransport’s extended connect request will be created as a normal fetch request. The listener for the events on this request will be different

All WebTransport events are put into a separate enum structure.

@ddragana ddragana marked this pull request as draft October 8, 2021 19:39
@ddragana
Copy link
Contributor Author

ddragana commented Oct 8, 2021

This is based on #1250 . The last 2 changes are new.

This is still a draft, because I need a find a good way to remove ExtendedConnectSession from the HashTable in ExtendedConnectFeature.

Copy link
Member

@martinthomson martinthomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together. I don't think that I was quite thorough enough with this review, but I've run out of time, so I'll let you have these commends and I'll take another look later.

I worry a little that the test coverage is a bit light given the amount of code involved here, but I need to think about it some more. The websockets question is an obvious one; there might be more.

Comment on lines 24 to 31
pub enum WebTransportEvent {
WebTransportNegotiated(bool),
WebTransportSession(u64),
WebTransportSessionClosed {
stream_id: u64,
error: Option<AppError>,
},
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look to be generic: they also apply to the server.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that the server needs more than just stream/session_id. It also need connection. There are not completely the same.

@@ -142,6 +154,33 @@ impl SendStreamEvents for Http3ClientEvents {
}
}

impl ExtendedConnectEvents for Http3ClientEvents {
fn extended_connect_session_established(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very long name. Any reason not to name these session_start/session_end. There are other things that might use "session" as a name, but we can revisit the names if a collision comes up.

I would add "negotiated(HSettingType)" to this interface.

Copy link
Contributor Author

@ddragana ddragana Oct 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

negotiated has been moved, there is not a separate listener for it.

neqo-http3/src/client_events.rs Show resolved Hide resolved
@@ -733,6 +737,116 @@ impl Http3Connection {
Ok(())
}

pub fn webtransport_create_session<'x, 't: 'x, T>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the lifetime constraints need to be different than the ones you now have on RequestDescription?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, because of some strings.

neqo-http3/src/connection.rs Outdated Show resolved Hide resolved
neqo-http3/src/server_events.rs Outdated Show resolved Hide resolved
/// Close sending side.
/// # Errors
/// It may return `InvalidStreamId` if a stream does not exist anymore.
pub fn stream_close_send(&mut self) -> Res<()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is implementing Deref[Mut] easier than replicating all these functions?

neqo-http3/tests/webtransport/mod.rs Outdated Show resolved Hide resolved
neqo-http3/tests/webtransport/mod.rs Outdated Show resolved Hide resolved
neqo-http3/tests/webtransport/mod.rs Outdated Show resolved Hide resolved
@ddragana
Copy link
Contributor Author

I have open a separate issue for this comment . That will be resolve in a separate PR. Let's review this part it is big.

@ddragana ddragana mentioned this pull request Oct 20, 2021
The fetch will be used by the extended connect requests aas well.
This PR creates a generic ExtendedConnectFeature structure that is responsible for a feature negotiation and keeps a HashMap of the extended connect requests. The HashMap will be used for finding active sessions.

An extended connect request will be created as a regular fetch request only the listener for the events will be different.  A generic ExtendedConnectSession structure is created for each extended connect request and is responsible for listening to request events and following the state of the request/session, e.g. the session is being negotiated, a stream is closed, etc..This structure will be responsible for bookkeeping, i.e. it will hold information about active streams open on a session and it will make sure to close all streams if the session request is closed.
Currently ExtendedConnectSession cannot read data from the request stream, this will be fixed in a separate PR.
On the server side, upon receiving headers a regular http request will be transformed into an extended connect request and a new ExtendedConnectSession will be set to be the listener for the request.

Regular http request functions will be used for closing an extended connect request, e.g. steam_stop_sending, cancel_fetch, etc.

Additional changes:
Now it is not easily possible to distinguish between Http stream and Push stream, therefore  RecvMessage holds the type of the stream.
WebTransport’s extended connect request will be created as a normal fetch request. The listener for the events on this request will be different

All WebTransport events are put into a separate enum structure.
@ddragana ddragana merged commit bfd63ca into mozilla:main Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants