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

Data channel does not close if dataChannel.Close is called in the OnDataChannel handler #2659

Open
timmattison opened this issue Feb 2, 2024 · 1 comment
Labels
bug Something isn't working difficulty:easy

Comments

@timmattison
Copy link

Your environment.

  • Version: 3.2.24
  • Browser: N/A

What did you do?

I set up a handler for OnDataConnection on the PeerConnection struct. This handler checks a few things to see if it's interested in the data channel or not. If it decides that it isn't interested it calls dataChannel.Close(). Otherwise, it sets up the OnOpen and OnMessage handlers.

What did you expect?

I expected the data channel to close on both sides of the connection immediately.

What happened?

The data channel's state went from connecting to open and stayed open. The call to dataChannel.Close() returns a nil error.

If I put the logic in the OnOpen handler it works. But I would've expected an error from Close() or for it to work no matter when it is called.

@Sean-Der Sean-Der added bug Something isn't working difficulty:easy labels Mar 30, 2024
@stephanrotolante
Copy link
Contributor

@timmattison would you mind sharing some code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working difficulty:easy
Development

No branches or pull requests

3 participants