Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
83dfc7152f | ||
d7e5f53e4f |
@@ -31,7 +31,7 @@ namespace Torch.Server
|
|||||||
private const string TOOL_DIR = "tool";
|
private const string TOOL_DIR = "tool";
|
||||||
private const string TOOL_ZIP = "temp.zip";
|
private const string TOOL_ZIP = "temp.zip";
|
||||||
private static readonly string TOOL_EXE = "steamcmd.exe";
|
private static readonly string TOOL_EXE = "steamcmd.exe";
|
||||||
private const string TOOL_ARGS = "+login anonymous +app_update 298740 +force_install_dir \"{0}\"";
|
private const string TOOL_ARGS = "+force_install_dir \"{0}\" +login anonymous +app_update 298740 +quit";
|
||||||
private TorchServer _server;
|
private TorchServer _server;
|
||||||
|
|
||||||
internal Persistent<TorchConfig> ConfigPersistent { get; }
|
internal Persistent<TorchConfig> ConfigPersistent { get; }
|
||||||
@@ -174,7 +174,7 @@ namespace Torch.Server
|
|||||||
while (!cmd.HasExited)
|
while (!cmd.HasExited)
|
||||||
{
|
{
|
||||||
if (await cmd.StandardOutput.ReadLineAsync() is { } line)
|
if (await cmd.StandardOutput.ReadLineAsync() is { } line)
|
||||||
log.Info(line); //seems to hang sometimes, maybe switch back to Thread.Sleep?
|
log.Info(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -69,6 +69,14 @@ namespace Torch.Server
|
|||||||
|
|
||||||
_simUpdateTimer.Elapsed += SimUpdateElapsed;
|
_simUpdateTimer.Elapsed += SimUpdateElapsed;
|
||||||
_simUpdateTimer.Start();
|
_simUpdateTimer.Start();
|
||||||
|
|
||||||
|
Console.CancelKeyPress += (_, _) =>
|
||||||
|
{
|
||||||
|
if (State == ServerState.Running)
|
||||||
|
Stop();
|
||||||
|
|
||||||
|
Environment.Exit(0);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SimUpdateElapsed(object sender, System.Timers.ElapsedEventArgs e)
|
private void SimUpdateElapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
@@ -239,9 +247,14 @@ namespace Torch.Server
|
|||||||
StopInternal();
|
StopInternal();
|
||||||
LogManager.Flush();
|
LogManager.Flush();
|
||||||
|
|
||||||
|
if (
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Environment.Exit(0);
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
|
true ||
|
||||||
#endif
|
#endif
|
||||||
|
ApplicationContext.Current.IsService
|
||||||
|
)
|
||||||
|
Environment.Exit(0);
|
||||||
|
|
||||||
var exe = Path.Combine(AppContext.BaseDirectory, "Torch.Server.exe");
|
var exe = Path.Combine(AppContext.BaseDirectory, "Torch.Server.exe");
|
||||||
|
|
||||||
|
@@ -116,7 +116,7 @@ namespace Torch.Server
|
|||||||
if (_server?.State == ServerState.Running)
|
if (_server?.State == ServerState.Running)
|
||||||
_server.Stop();
|
_server.Stop();
|
||||||
|
|
||||||
Process.GetCurrentProcess().Kill();
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -372,10 +372,10 @@ namespace Torch
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual void Stop()
|
public virtual void Stop()
|
||||||
{
|
{
|
||||||
LogManager.Flush();
|
|
||||||
Game.SignalStop();
|
Game.SignalStop();
|
||||||
if (!Game.WaitFor(VRageGame.GameState.Stopped))
|
if (!Game.WaitFor(VRageGame.GameState.Stopped, TimeSpan.FromSeconds(Config.TickTimeout)))
|
||||||
Log.Warn("Failed to wait for the game to be stopped");
|
Log.Warn("Failed to wait for the game to be stopped");
|
||||||
|
LogManager.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
Reference in New Issue
Block a user