mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-31 00:50:45 +01:00
Gah
This commit is contained in:
@@ -112,6 +112,24 @@ namespace Tgstation.Server.Host.Components.Session
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a given <paramref name="port"/> can be bound to.
|
||||
/// </summary>
|
||||
/// <param name="port">The port number to test.</param>
|
||||
static void PortBindTest(ushort port)
|
||||
{
|
||||
using var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
||||
try
|
||||
{
|
||||
socket.Bind(new IPEndPoint(IPAddress.Loopback, port));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new JobException(ErrorCode.DreamDaemonPortInUse, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct a <see cref="SessionControllerFactory"/>
|
||||
/// </summary>
|
||||
@@ -425,23 +443,5 @@ namespace Tgstation.Server.Host.Components.Session
|
||||
if(otherUserName.Equals(ourUserName, StringComparison.Ordinal))
|
||||
throw new JobException(ErrorCode.DeploymentPagerRunning);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a given <paramref name="port"/> can be bound to.
|
||||
/// </summary>
|
||||
/// <param name="port">The port number to test.</param>
|
||||
static void PortBindTest(ushort port)
|
||||
{
|
||||
using var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
||||
try
|
||||
{
|
||||
socket.Bind(new IPEndPoint(IPAddress.Loopback, port));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new JobException(ErrorCode.DreamDaemonPortInUse, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user