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

Implement flow allowing disconnection from online services when another client instance for same user is detected #25522

Merged
merged 5 commits into from
Nov 28, 2023

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Nov 21, 2023

Prerequisite for ppy/osu-server-spectator#80.

In action:

2023-11-21.15-12-55.mp4

In short, when a user logs in on one client instance, and then on another, the previous instance is forcibly logged out. It can be restored to full online operation by logging in again, at which point any other online instance will be forcibly logged out. So the goal here is to keep concurrency to 1.

The reason that this does a full logout rather than something more limited is (a) that it's easy to integrate with existing systems, and also (b) avoids weirdness. For instance, we could theoretically allow the user to solo even with concurrent client instances, were it not for the fact that osu-server-spectator - namely SpectatorHub - participates in the replay recording part of score submission, and cannot handle concurrency.

This currently has no testing other than manual, but I'm not sure anything more is feasible anyway. I'm also not sure of the general shape of this, which is why I'm opening as draft and refraining from adding tests until requested and I am sure that there's at least an agreement that this looks how everyone would want it to look.

When the server requests a disconnect due to a user connecting
via a second device, the client will now log the user out on the first
device and show a notification informing them of the cause of
disconnection.
@@ -98,7 +98,9 @@ public virtual void PartRoom()
if (JoinedRoom.Value == null)
return;

api.Queue(new PartRoomRequest(joinedRoom.Value));
if (api.State.Value == APIState.Online)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this check is it actually feasible that this fires and causes issues?

Copy link
Collaborator Author

@bdach bdach Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I hit this once in testing.

That said I'll probably look at this again, after I'm somewhat sure this pair of PRs is going in the correct direction.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this again, I think there should be no issues with this. Server-side flows are supposed to correctly clean up the room anyway, so this request not being realised should have no impact on the server.

@peppy
Copy link
Member

peppy commented Nov 22, 2023

I think this is looking pretty decent.

@bdach bdach marked this pull request as ready for review November 22, 2023 03:47
@bdach bdach self-assigned this Nov 27, 2023
@peppy peppy merged commit 537c9e0 into ppy:master Nov 28, 2023
12 of 17 checks passed
@bdach bdach deleted the no-concurrent-connections branch January 23, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants