diff --git a/README.md b/README.md index 89d12d953e..86835572e9 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,9 @@ The service supports updates while running a DreamDaemon instance. Simply instal * `Instance.cfg` * The encrypted internal configuration settings for a server instance. Note that access to this file bypasses API user restrictions +### 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` diff --git a/TGInstallerWrapper/Main.cs b/TGInstallerWrapper/Main.cs index 79d8ac3081..1c6b6cea85 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"; @@ -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())); } } @@ -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 { diff --git a/TGServerService/EventID.cs b/TGServerService/EventID.cs index 5d4775fa55..9562de35aa 100644 --- a/TGServerService/EventID.cs +++ b/TGServerService/EventID.cs @@ -283,8 +283,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/Compiler.cs b/TGServerService/ServerInstance/Compiler.cs index d0701e51bb..dc29bcd5a5 100644 --- a/TGServerService/ServerInstance/Compiler.cs +++ b/TGServerService/ServerInstance/Compiler.cs @@ -482,38 +482,22 @@ 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 - { - var rgdl = RelativePath(GameDirLive); - if (Directory.Exists(rgdl)) - //these next two lines should be atomic but this is the best we can do - Directory.Delete(rgdl); - CreateSymlink(rgdl, resurrectee); - } - finally - { - if (online && !Proc.HasExited) - Proc.Resume(); - } + var rgdl = RelativePath(GameDirLive); + if (Directory.Exists(rgdl)) + //these next two lines should be atomic but this is the best we can do + Directory.Delete(rgdl); + CreateSymlink(rgdl, 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; diff --git a/TGServerService/ServerInstance/DreamDaemon.cs b/TGServerService/ServerInstance/DreamDaemon.cs index 62fbafc95a..9f68a48bb1 100644 --- a/TGServerService/ServerInstance/DreamDaemon.cs +++ b/TGServerService/ServerInstance/DreamDaemon.cs @@ -584,6 +584,7 @@ namespace TGServerService GameAPIVersion = null; //needs updating } Proc.Start(); + Proc.PriorityClass = ProcessPriorityClass.AboveNormal; if (!Proc.WaitForInputIdle(DDHangStartTime * 1000)) { diff --git a/TGServerService/ServerInstance/Repository.cs b/TGServerService/ServerInstance/Repository.cs index e3b75ee058..1f6368355a 100644 --- a/TGServerService/ServerInstance/Repository.cs +++ b/TGServerService/ServerInstance/Repository.cs @@ -639,20 +639,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}", RelativePath(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); + WriteWarning(msg, EventID.Submodule); } - catch + catch (Exception ex) { - throw e; + 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); - WriteWarning(msg, EventID.SubmoduleReclone); } } diff --git a/TGServiceInterface/Interface.cs b/TGServiceInterface/Interface.cs index 816e5f9576..e1ab437878 100644 --- a/TGServiceInterface/Interface.cs +++ b/TGServiceInterface/Interface.cs @@ -156,7 +156,7 @@ namespace TGServiceInterface var splits = GetService().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; diff --git a/Version.cs b/Version.cs index 0ec031ba90..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.5.2")] -[assembly: AssemblyFileVersion("3.1.5.2")] -[assembly: AssemblyInformationalVersion("3.1.5.2")] +[assembly: AssemblyVersion("3.1.6.1")] +[assembly: AssemblyFileVersion("3.1.6.1")] +[assembly: AssemblyInformationalVersion("3.1.6.1")]