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

Return DisconnectReason in the DisconnectEvent for clients #416

Merged
merged 2 commits into from
May 29, 2024

Conversation

cBournhonesque
Copy link
Owner

Currently the user has no way of accessing the reason why the connection was not successful (or the reason they got disconnected). There are usually some error! logs printed, but the user might need to access the value to handle it in some ad-hoc way.

In this PR, we add:

  • a DisconnectReason enum to the client's Disconnect event. It gets populated when we have an io-based error, netcode error or steam error
  • the ClientConnection.state() now returns a ConnectionState instead of a NetworkingState

(- I also add a NetworkingState::None enum to avoid running the OnDisconnect schedule at the start of the app)

Addresses part of #410 (comment)

@cBournhonesque cBournhonesque merged commit 90a7a6d into main May 29, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant