Fixes for 2017-11-17 major

This commit is contained in:
John Gross
2017-11-17 12:11:11 -08:00
parent c07a01a427
commit 25e6f27854
3 changed files with 10 additions and 6 deletions

View File

@@ -45,7 +45,9 @@ quit";
if (_init) if (_init)
return false; return false;
#if !DEBUG
AppDomain.CurrentDomain.UnhandledException += HandleException; AppDomain.CurrentDomain.UnhandledException += HandleException;
#endif
if (!args.Contains("-noupdate")) if (!args.Contains("-noupdate"))
RunSteamCmd(); RunSteamCmd();
@@ -61,11 +63,11 @@ quit";
var pid = int.Parse(_config.WaitForPID); var pid = int.Parse(_config.WaitForPID);
var waitProc = Process.GetProcessById(pid); var waitProc = Process.GetProcessById(pid);
Log.Info("Continuing in 5 seconds."); Log.Info("Continuing in 5 seconds.");
Thread.Sleep(5000); Log.Warn($"Waiting for process {pid} to close");
if (!waitProc.HasExited) while (!waitProc.HasExited)
{ {
Log.Warn($"Killing old process {pid}."); Console.Write(".");
waitProc.Kill(); Thread.Sleep(1000);
} }
} }

View File

@@ -163,6 +163,7 @@ namespace Torch.Server
Log.Info("Starting server."); Log.Info("Starting server.");
MySandboxGame.IsDedicated = true; MySandboxGame.IsDedicated = true;
MySandboxGame.ConfigDedicated = DedicatedInstance.DedicatedConfig.Model;
Environment.SetEnvironmentVariable("SteamAppId", MyPerServerSettings.AppId.ToString()); Environment.SetEnvironmentVariable("SteamAppId", MyPerServerSettings.AppId.ToString());
VRage.Service.ExitListenerSTA.OnExit += delegate { MySandboxGame.Static?.Exit(); }; VRage.Service.ExitListenerSTA.OnExit += delegate { MySandboxGame.Static?.Exit(); };
@@ -309,6 +310,7 @@ namespace Torch.Server
var exe = Assembly.GetExecutingAssembly().Location; var exe = Assembly.GetExecutingAssembly().Location;
((TorchConfig)Config).WaitForPID = Process.GetCurrentProcess().Id.ToString(); ((TorchConfig)Config).WaitForPID = Process.GetCurrentProcess().Id.ToString();
Process.Start(exe, Config.ToString()); Process.Start(exe, Config.ToString());
Stop();
Environment.Exit(0); Environment.Exit(0);
} }

View File

@@ -193,7 +193,7 @@ namespace Torch
/// <param name="action"></param> /// <param name="action"></param>
public void Invoke(Action action) public void Invoke(Action action)
{ {
MySandboxGame.Static.Invoke(action); MySandboxGame.Static.Invoke(action, "Torch");
} }
/// <summary> /// <summary>
@@ -240,7 +240,7 @@ namespace Torch
{ {
e.Set(); e.Set();
} }
}); }, "Torch");
if (!e.WaitOne(60000)) if (!e.WaitOne(60000))
throw new TimeoutException("The game action timed out."); throw new TimeoutException("The game action timed out.");