Forcefully leave room on multiplayer exit#35971
Conversation
| if (Room == null) | ||
| return Task.CompletedTask; |
There was a problem hiding this comment.
I don't really know why this was added or necessary, because it doesn't look to be. Basically, there's a moment in time (that can actually be quite lengthy due to user lookups), where the room is "joined" but Room hasn't been set. The patch in the OP shows this.
It seems like we should always run through the full leave process?
There was a problem hiding this comment.
Originates from 02369ba. Appears it wasn't asked about at review time, probably because it looked obvious / harmless.
| if (Room == null) | ||
| return Task.CompletedTask; |
There was a problem hiding this comment.
Originates from 02369ba. Appears it wasn't asked about at review time, probably because it looked obvious / harmless.
| if (base.OnExiting(e)) | ||
| return true; | ||
|
|
||
| client.LeaveRoom().FireAndForget(); |
There was a problem hiding this comment.
While we're here doing this, the xmldoc says this can throw:
but looking at the server-side implementation I don't see how it can throw because this specific scenario is guarded to do nothing instead of throwing, so might as well strip that mention.
Fixes #35886 (comment)
Seems pretty difficult to unit test this so I've only tested via:
Will document more in comments on the PR itself.