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

Add functionality for graceful disconnects with Fragmented channels #35

Open
cdanek opened this issue Nov 16, 2021 · 0 comments
Open

Add functionality for graceful disconnects with Fragmented channels #35

cdanek opened this issue Nov 16, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@cdanek
Copy link

cdanek commented Nov 16, 2021

When a server disconnects a connection that has ReliableSequencedFragmented as the channel type (and potentially others), any pending packets are not sent to the client. This results in "friendly disconnects" (use case - user is on the wrong version of the client, needs a message telling them to upgrade, then disconnect them) not being received by the client, since the _pendingSends aren't flushed to the socket, they're simply reclaimed. See ReliableSequencedFragmented.Release().

I believe I understand the motivation - the Disconnect event should disconnect immediately and not dump data to clients - but there isn't a mechanism to flush() partial packets to users. Unfortunately, I think alternative approaches are not good (ask the client to disconnect in the "final packet" and trust them to do so; mark a connection as pending disconnect and complete the disconnect after MergeDelay amount of time; or my solution - expose a second Send() method with noMerge=true for these scenarios).

I'm not sure if this repo is being actively developed any further with the maintainer moving over into other unity networking solutions, but if the maintainer (or anyone else capable) would like to, this would be a nice feature, both for this use case and others.

Proposal 1: Add Flush() to IChannel and implement in the various channel implementations
Proposal 2: Expose method for polling count of _pendingSends in the channels.
Proposal 3: Add another Disconnect() method or parameter that attempts to Flush() pending/unmerged packets to the client.

Thanks for the consideration

@cdanek cdanek added the enhancement New feature or request label Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant