Fix socket lingering

This commit is contained in:
Jordan Dominion
2023-10-15 16:02:38 -04:00
parent 421e4f828e
commit 4fbdb9a67d
2 changed files with 2 additions and 3 deletions
@@ -217,7 +217,6 @@ namespace Tgstation.Server.Host.Components.Session
if (!launchParameters.Port.HasValue)
throw new InvalidOperationException("Given port is null!");
PortBindTest(launchParameters.Port.Value);
switch (dmbProvider.CompileJob.MinimumSecurityLevel)
{
case DreamDaemonSecurity.Ultrasafe:
@@ -255,8 +254,7 @@ namespace Tgstation.Server.Host.Components.Session
if (dmbProvider.EngineVersion.Engine.Value == EngineType.Byond)
await CheckPagerIsNotRunning();
if (platformIdentifier.IsWindows)
await asyncDelayer.Delay(TimeSpan.FromMilliseconds(500), cancellationToken); // Server can trip after we bind tested the port
PortBindTest(launchParameters.Port.Value);
string outputFilePath = null;
var preserveLogFile = true;
@@ -23,6 +23,7 @@ namespace Tgstation.Server.Host.Extensions
ProtocolType.Tcp);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, true);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontLinger, true);
if (includeIPv6)
socket.DualMode = true;