-
Notifications
You must be signed in to change notification settings - Fork 74
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
WebRTC opening failure panic #2900
Comments
The problem is simply caused by the fact that the browser calls the Because we only register the data channel after the This is a bit tricky to solve, because the definition of "open" of a WebRTC connection is a bit hacky. |
I think that this is simply solved by making |
I'll wait for #2925 in order to not introduce annoying merge conflicts. |
Actually, the idea is that we should just try opening the substream again. |
Related comment from the spec:
|
Fix #2900 In order to open outbound substreams on a WebRTC connection, the mechanism that the API of smoldot uses is as follows: one function to ask the implementation to open a substream, and one callback that is later called in order to notify that a substream has been fully opened. The API of smoldot doesn't provide a way to report that opening an outbound substream has failed. This is because this isn't really supposed to happen. If you have a connection, opening a substream is purely a "local side change": you allocate an ID, then send a message. It should maybe not even be asynchronous, but that's off-topic here. The problem here is that this mental model doesn't really fit what the browser does. In particular, the browser does nothing until a data channel is first opened, plus the browser can call `onclose` or `onerror` on the data channel before `onopen`. To accomodate for that, the current code is a bit hacky in the sense that it reports the connection as immediately open. This PR does it a bit more differently and more properly: we immediately open a data channel at the same time as we create the `RTCPeerConnection` in order for the browser to start connecting, even though smoldot didn't request a channel yet. We store this first data channel on the side, and when smoldot asks for a data channel we provide this one. If a data channel closes while it is still opening (the handshake one or another), we just kill the entire connection.
That's not really related. |
When a WebRTC connection fails to open, there seems to be a panic here:
smoldot/bin/wasm-node/rust/src/platform.rs
Line 705 in bc36d66
The text was updated successfully, but these errors were encountered: