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

Switch to using named pipes for IPC #6442

Merged
merged 9 commits into from
Dec 6, 2024
Merged

Conversation

peppy
Copy link
Member

@peppy peppy commented Dec 3, 2024

Resolves ppy/osu#30783.

Has come up a few times in recent months so worthwhile fixing.

I've used this opportunity to also make the API a touch more robust and lock in the bidirectional messaging API too.

Breaking Changes

osu!framework now uses named pipes for IPC instead of TCP ports

This resolves cases where other applications may be reserving ranges of ports on localhost (as we found is common of WSL). Things should still work out-of-the-box if you are already using IPC, but you may want to update your usage as we've obsoleted the port specification:

diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs
index 1a9aade377..bb9b0c30fa 100644
--- a/osu.Desktop/Program.cs
+++ b/osu.Desktop/Program.cs
@@ -99,7 +99,7 @@ public static void Main(string[] args)
 
             var hostOptions = new HostOptions
             {
-                IPCPort = 12345,
+                IPCPipeName = "my-app-unique-id",
                 FriendlyGameName = OsuGameBase.GAME_NAME,
             };
 

In addition, there's now a new SendMessageWithResponseAsync exposed by GameHost which can be used for bidirectional messaging. If you wish to make use of this, you should make an IpcChannel<T,TResponse> with well defined types for the sending and responding messages.

@smoogipoo
Copy link
Contributor

Need some build inspection issues fixed here.

@peppy
Copy link
Member Author

peppy commented Dec 3, 2024

Yeah having issues with rider showing hundreds of warnings at the moment, bit frustrating.

@smoogipoo smoogipoo merged commit 2e19f17 into ppy:master Dec 6, 2024
13 of 14 checks passed
@@ -146,8 +146,6 @@ public abstract class GameHost : IIpcHost, IDisposable
public virtual Task SendMessageAsync(IpcMessage message) => throw new NotSupportedException("This platform does not implement IPC.");
public virtual Task<IpcMessage> SendMessageWithResponseAsync(IpcMessage message) => throw new NotSupportedException("This platform does not implement IPC.");

public virtual Task SendM(IpcMessage message) => throw new NotSupportedException("This platform does not implement IPC.");
Copy link
Member Author

Choose a reason for hiding this comment

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

what the 😅

peppy added a commit to peppy/osu-framework that referenced this pull request Dec 11, 2024
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.
peppy added a commit to peppy/osu-framework that referenced this pull request Dec 11, 2024
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.
peppy added a commit to peppy/osu-framework that referenced this pull request Dec 11, 2024
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.

2 participants