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

Make IPC port configurable via HostOptions #6129

Merged
merged 5 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions osu.Framework/HostOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public class HostOptions
/// </summary>
public bool BindIPC { get; set; }

/// <summary>
/// The IPC port to bind. See <see cref="IIpcHost"/> for more details on usage.
tsunyoku marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
public int IPCPort { get; set; } = 45356;
tsunyoku marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Whether this is a portable installation. Will cause all game files to be placed alongside the executable, rather than in the standard data directory.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions osu.Framework/Platform/DesktopGameHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ namespace osu.Framework.Platform
{
public abstract class DesktopGameHost : SDL2GameHost
{
public const int IPC_PORT = 45356;

private TcpIpcProvider ipcProvider;
private readonly bool bindIPCPort;
private readonly int ipcPort;

protected DesktopGameHost(string gameName, HostOptions options = null)
: base(gameName, options)
{
bindIPCPort = Options.BindIPC;
ipcPort = Options.IPCPort;
IsPortableInstallation = Options.PortableInstallation;
}

Expand Down Expand Up @@ -63,7 +63,7 @@ private void ensureIPCReady()
if (ipcProvider != null)
return;

ipcProvider = new TcpIpcProvider(IPC_PORT);
ipcProvider = new TcpIpcProvider(ipcPort);
ipcProvider.MessageReceived += OnMessageReceived;

IsPrimaryInstance = ipcProvider.Bind();
Expand Down