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

Fix multiple instances of a game being allowed to start concurrently #6452

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

peppy
Copy link
Member

@peppy peppy commented Dec 11, 2024

Regressed with #6442. Closes ppy/osu#31072.

Was not visible in test coverage because as per the inline comment, this is an exceptional case where two different processes bind.

I'm not sure how to add test coverage for this, but I have tested manually on both windows and macOS.

Can test using this:

diff --git a/SampleGame.Desktop/Program.cs b/SampleGame.Desktop/Program.cs
index 4756edbaa..ae5075535 100644
--- a/SampleGame.Desktop/Program.cs
+++ b/SampleGame.Desktop/Program.cs
@@ -12,9 +12,17 @@ public static class Program
         [STAThread]
         public static void Main(string[] args)
         {
-            using (GameHost host = Host.GetSuitableDesktopHost(@"sample-game"))
+            using (GameHost host = Host.GetSuitableDesktopHost(@"sample-game", new HostOptions
+                   {
+                       IPCPipeName = "wang"
+                   }))
             using (Game game = new SampleGameGame())
+            {
+                if (host.IsPrimaryInstance)
+                    return;
+
                 host.Run(game);
+            }
         }
     }
 }

Regressed with ppy#6442.

Was not visible in test coverage because as per the inline comment, this
is an exceptional case where two different processes bind.

I'm not sure how to add test coverage for this, but I have tested
manually on both windows and macOS.
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.

Can open multiple instances on Linux
1 participant