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

View File

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

View File

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