From d6e1cd02341ed05793cf81e57163080765b30b16 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Tue, 24 Oct 2017 16:52:29 -0400 Subject: [PATCH 01/10] Removes old process priority compiler shennanigans --- TGServerService/ServerInstance/Compiler.cs | 36 ++++++---------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/TGServerService/ServerInstance/Compiler.cs b/TGServerService/ServerInstance/Compiler.cs index ff5e781a4f..6ed2f315e8 100644 --- a/TGServerService/ServerInstance/Compiler.cs +++ b/TGServerService/ServerInstance/Compiler.cs @@ -487,37 +487,21 @@ namespace TGServerService { lock (watchdogLock) { + //gotta go fast + var online = currentStatus == DreamDaemonStatus.Online; + if (online) + Proc.Suspend(); try { - //gotta go fast - var online = currentStatus == DreamDaemonStatus.Online; - if (online) - Proc.Suspend(); - try - { - if (Directory.Exists(GameDirLive)) - //these two lines should be atomic but this is the best we can do - Directory.Delete(GameDirLive); - CreateSymlink(GameDirLive, resurrectee); - } - finally - { - if (online && !Proc.HasExited) - Proc.Resume(); - } + if (Directory.Exists(GameDirLive)) + //these two lines should be atomic but this is the best we can do + Directory.Delete(GameDirLive); + CreateSymlink(GameDirLive, resurrectee); } finally { - if (currentStatus == DreamDaemonStatus.Online) - { - try - { - Proc.PriorityClass = ProcessPriorityClass.Normal; - } - catch { } - Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal; - Thread.CurrentThread.Priority = ThreadPriority.Normal; - } + if (online && !Proc.HasExited) + Proc.Resume(); } } var staged = DaemonStatus() != DreamDaemonStatus.Offline; From 196eac3a949af8a9e39c3e85e264e03c35eb7cdf Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 26 Oct 2017 10:04:57 -0400 Subject: [PATCH 02/10] DreamDaemon now runs with an AboveNormal ProcessPriorityClass --- TGServerService/ServerInstance/DreamDaemon.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TGServerService/ServerInstance/DreamDaemon.cs b/TGServerService/ServerInstance/DreamDaemon.cs index 1072fb5722..b55344042b 100644 --- a/TGServerService/ServerInstance/DreamDaemon.cs +++ b/TGServerService/ServerInstance/DreamDaemon.cs @@ -583,6 +583,7 @@ namespace TGServerService GameAPIVersion = null; //needs updating } Proc.Start(); + Proc.PriorityClass = ProcessPriorityClass.AboveNormal; if (!Proc.WaitForInputIdle(DDHangStartTime * 1000)) { From fb242b5548ab64a5c0cb743f19c9a35efc47c89d Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Fri, 27 Oct 2017 16:38:42 -0400 Subject: [PATCH 03/10] Version bump to 3.1.6.0 [TGSDeploy] --- Version.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Version.cs b/Version.cs index 87f3405212..98e344bafb 100644 --- a/Version.cs +++ b/Version.cs @@ -12,6 +12,6 @@ using System.Reflection; // [assembly: AssemblyVersion("1.0.*")] //It's impossible to make these a define, don't say I didn't warn you -[assembly: AssemblyVersion("3.1.5.1")] -[assembly: AssemblyFileVersion("3.1.5.1")] -[assembly: AssemblyInformationalVersion("3.1.5.1")] +[assembly: AssemblyVersion("3.1.6.0")] +[assembly: AssemblyFileVersion("3.1.6.0")] +[assembly: AssemblyInformationalVersion("3.1.6.0")] From 1923d965c0f34b307f205007bb8643f65a2059e4 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 28 Oct 2017 02:02:12 -0400 Subject: [PATCH 04/10] Adds codebase integration to the README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 0002660659..71029aaa19 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,9 @@ The service supports updates while running a DreamDaemon instance. Simply instal * `TGS3.json` * This is a copy of TGS3.json from the Repository. If a repostory change creates differences between the two, update operations will be blocked until the user confirms they want to change it +### Codebase integration +To get the TGS3 API for your code base, import the 3 .dm files in the `DMAPI` folder into your include structure, then fill out the configuration as documented in the comments of server_tools.dm. Then, you may want to add a TGS3.json file to specify any static directories and .dlls your codebase uses, along with the optional changelog compile options. + ### Starting the game server: To run the game server, open the `Server` tab of the control panel and click either `Start` From 3baf58b48b3ddf10bae4e00bacef063d220b1750 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 30 Oct 2017 09:53:16 -0400 Subject: [PATCH 05/10] Catches submodule update exception --- TGServerService/EventID.cs | 3 ++- TGServerService/ServerInstance/Repository.cs | 25 +++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/TGServerService/EventID.cs b/TGServerService/EventID.cs index 114173498d..02824101ab 100644 --- a/TGServerService/EventID.cs +++ b/TGServerService/EventID.cs @@ -276,8 +276,9 @@ namespace TGServerService IRCLogModes = 6500, /// /// Warning: When the Repository submodule handler has to reclone a submodule entirely. This is a long operation and is due to an upstream bug + /// Error: When a submodule update operation fails completely /// - SubmoduleReclone = 6600, + Submodule = 6600, /// /// This event is of type or . It occurs when a user different from the previous one tries and either succeeds or fails to access a . DreamDaemon itself successfully accessing will not trigger this /// diff --git a/TGServerService/ServerInstance/Repository.cs b/TGServerService/ServerInstance/Repository.cs index b58f9c31b1..0ebbddb121 100644 --- a/TGServerService/ServerInstance/Repository.cs +++ b/TGServerService/ServerInstance/Repository.cs @@ -637,20 +637,27 @@ namespace TGServerService } catch (Exception e) { - //workaround for https://github.com/libgit2/libgit2/issues/3820 - //kill off the modules/ folder in .git and try again try { - Program.DeleteDirectory(String.Format("{0}/.git/modules/{1}", RepoPath, I.Path)); + //workaround for https://github.com/libgit2/libgit2/issues/3820 + //kill off the modules/ folder in .git and try again + try + { + Program.DeleteDirectory(String.Format("{0}/.git/modules/{1}", RepoPath, I.Path)); + } + catch + { + throw e; + } + Repo.Submodules.Update(I.Name, suo); + var msg = String.Format("I had to reclone submodule {0}. If this is happening a lot find a better hack or fix https://github.com/libgit2/libgit2/issues/3820!", I.Name); + SendMessage(String.Format("REPO: {0}", msg), MessageType.DeveloperInfo); + Service.WriteWarning(msg, EventID.Submodule); } - catch + catch (Exception ex) { - throw e; + Service.WriteError(String.Format("Failed to update submodule {0}! Error: {1}", I.Name, ex.ToString()), EventID.Submodule); } - Repo.Submodules.Update(I.Name, suo); - var msg = String.Format("I had to reclone submodule {0}. If this is happening a lot find a better hack or fix https://github.com/libgit2/libgit2/issues/3820!", I.Name); - SendMessage(String.Format("REPO: {0}", msg), MessageType.DeveloperInfo); - Service.WriteWarning(msg, EventID.SubmoduleReclone); } } From 8a32ace982f690083af38d6becc142e7bc57d775 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Mon, 30 Oct 2017 10:03:45 -0400 Subject: [PATCH 06/10] Version bump to 3.1.6.1 [TGSDeploy] --- Version.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Version.cs b/Version.cs index 98e344bafb..cd11a44fd9 100644 --- a/Version.cs +++ b/Version.cs @@ -12,6 +12,6 @@ using System.Reflection; // [assembly: AssemblyVersion("1.0.*")] //It's impossible to make these a define, don't say I didn't warn you -[assembly: AssemblyVersion("3.1.6.0")] -[assembly: AssemblyFileVersion("3.1.6.0")] -[assembly: AssemblyInformationalVersion("3.1.6.0")] +[assembly: AssemblyVersion("3.1.6.1")] +[assembly: AssemblyFileVersion("3.1.6.1")] +[assembly: AssemblyInformationalVersion("3.1.6.1")] From 633eaa642cdd706d4cc2f8c2038159806d66539e Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 30 Oct 2017 10:14:20 -0400 Subject: [PATCH 07/10] Adds a warning about static directory deletion when updating from 3.0 --- TGInstallerWrapper/Main.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TGInstallerWrapper/Main.cs b/TGInstallerWrapper/Main.cs index 79d8ac3081..3b20b27d3d 100644 --- a/TGInstallerWrapper/Main.cs +++ b/TGInstallerWrapper/Main.cs @@ -95,6 +95,8 @@ namespace TGInstallerWrapper try { VersionLabel.Text = (string)Version.Invoke(GetComponentITGSService.Invoke(null, null), null); + if (VersionLabel.Text.Contains("v3.0")) //OH GOD!!!! + MessageBox.Show("Warning! Upgrading from version 3.0 may trigger a bug that can delete /config and /data. IT IS STRONGLY RECCOMMENDED THAT YOU BACKUP THESE FOLDERS BEFORE UPDATING!"); } catch { From 01e5d8370c70116a67772efb0336a9686b4b3ac8 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 30 Oct 2017 10:26:18 -0400 Subject: [PATCH 08/10] Shows an error message when the interface DLL fails to load --- TGInstallerWrapper/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TGInstallerWrapper/Main.cs b/TGInstallerWrapper/Main.cs index 79d8ac3081..b497c0b6cc 100644 --- a/TGInstallerWrapper/Main.cs +++ b/TGInstallerWrapper/Main.cs @@ -80,11 +80,11 @@ namespace TGInstallerWrapper Version = ITGSService.GetMethod(InterfaceServiceInterfaceVersion); PrepareForUpdate = ITGSService.GetMethod(InterfaceServiceInterfacePrepareForUpdate); } - catch + catch (Exception e) { InterfaceAssembly = null; VersionLabel.Text = "Error: (Could not load interface dll)"; - return; + MessageBox.Show(String.Format("An error occurred while loading {0} (This is an easily preventable bug, please report it)! Error: {1}", InterfaceDLL, e.ToString())); } } From 2450bbaf861868e99febe852e47731f1fb0ab259 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Mon, 30 Oct 2017 10:30:20 -0400 Subject: [PATCH 09/10] Fixes installer interface reflection --- TGInstallerWrapper/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TGInstallerWrapper/Main.cs b/TGInstallerWrapper/Main.cs index 79d8ac3081..76b6c82af7 100644 --- a/TGInstallerWrapper/Main.cs +++ b/TGInstallerWrapper/Main.cs @@ -18,7 +18,7 @@ namespace TGInstallerWrapper const string InterfaceDLL = "TGServiceInterface.dll"; const string InterfaceNamespace = "TGServiceInterface"; const string InterfaceComponentsNamespace = InterfaceNamespace + ".Components"; - const string InterfaceClass = InterfaceNamespace + ".Server"; + const string InterfaceClass = InterfaceNamespace + ".Interface"; const string InterfaceServiceInterface = InterfaceComponentsNamespace + ".ITGSService"; //fuck this typo const string InterfaceClassVerifyConnection = "VerifyConnection"; const string InterfaceClassGetComponent = "GetComponent"; From 332772c13f464f3db3cfc224d3092b86150e8e67 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Mon, 30 Oct 2017 10:49:18 -0400 Subject: [PATCH 10/10] Version mismatch warning won't be triggered for service/interface versions within the same minor release number --- TGServiceInterface/Interface.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TGServiceInterface/Interface.cs b/TGServiceInterface/Interface.cs index 21a196edba..7cbbd1f090 100644 --- a/TGServiceInterface/Interface.cs +++ b/TGServiceInterface/Interface.cs @@ -141,7 +141,7 @@ namespace TGServiceInterface var splits = Interface.GetComponent().Version().Split(' '); var theirs = new Version(splits[splits.Length - 1].Substring(1)); var ours = new Version(FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion); - if(theirs != ours) + if(theirs.Major != ours.Major || theirs.Minor != ours.Minor || theirs.Revision != ours.Revision) //don't care about the patch level { errorMessage = String.Format("Version mismatch between interface version ({0}) and service version ({1}). Some functionality may crash this program.", ours, theirs); return true;