From 3fc4283183374050ef157e8f88fa472d3e712ee8 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 21 Oct 2017 17:08:38 -0400 Subject: [PATCH 1/3] Guards the interface DLL copy operation --- TGServerService/DreamDaemon.cs | 31 +++++++++++++++++++++++++++++-- TGServerService/ServerService.cs | 2 ++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index ff6fac5c66..c56993a803 100644 --- a/TGServerService/DreamDaemon.cs +++ b/TGServerService/DreamDaemon.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics; using System.IO; +using System.Linq; using System.Reflection; using System.Threading; using System.Timers; @@ -438,11 +439,37 @@ namespace TGServerService void UpdateInterfaceDll(bool overwrite) { - if (File.Exists(InterfaceDLLName) && !overwrite) + var FileExists = File.Exists(InterfaceDLLName); + if (FileExists && !overwrite) return; //Copy the interface dll to the static dir var InterfacePath = Assembly.GetAssembly(typeof(DDInteropCallHolder)).Location; - File.Copy(InterfacePath, InterfaceDLLName, overwrite); + try + { + if (FileExists) + { + var Old = File.ReadAllBytes(InterfaceDLLName); + var New = File.ReadAllBytes(InterfacePath); + if (Old.SequenceEqual(New)) + return; //no need + } + File.Copy(InterfacePath, InterfaceDLLName, overwrite); + TGServerService.WriteInfo("Updated interface DLL", TGServerService.EventID.InterfaceDLLUpdated); + } + catch + { + try + { + //ok the things being stupid and hasn't released the dll yet, try ONCE more + Thread.Sleep(1000); + File.Copy(InterfacePath, InterfaceDLLName, overwrite); + } + catch (Exception e) + { + //intentionally using the fi + TGServerService.WriteError("Failed to update interface DLL! Error: " + e.ToString(), TGServerService.EventID.InterfaceDLLUpdateFail); + } + } } //used by Start and Watchdog to start a DD instance diff --git a/TGServerService/ServerService.cs b/TGServerService/ServerService.cs index f277dfd2f9..426024138f 100644 --- a/TGServerService/ServerService.cs +++ b/TGServerService/ServerService.cs @@ -70,6 +70,8 @@ namespace TGServerService RepoPushFail = 5500, RepoChangelog = 5600, RepoChangelogFail = 5700, + InterfaceDLLUpdated = 5800, + InterfaceDLLUpdateFail = 5900, ServiceShutdownFail = 6100, WorldReboot = 6200, ServerUpdateApplied = 6300, From 11b7005f6654b4032a146967a699168c1aad7f2f Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sat, 21 Oct 2017 18:08:46 -0400 Subject: [PATCH 2/3] IRC messages are now sent in bulk --- TGServerService/IRC.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/TGServerService/IRC.cs b/TGServerService/IRC.cs index a04dfc2d36..8017dac86d 100644 --- a/TGServerService/IRC.cs +++ b/TGServerService/IRC.cs @@ -41,7 +41,7 @@ namespace TGServerService irc.OnChannelMessage += Irc_OnChannelMessage; irc.OnQueryMessage += Irc_OnQueryMessage; } - + //public api public string SendMessageDirect(string message, string channel) { @@ -265,15 +265,18 @@ namespace TGServerService return; lock (IRCLock) { - foreach (var cid in irc.JoinedChannels) + string cids = ""; + for (var I = 0; I < irc.JoinedChannels.Count; ++I) { + var cid = irc.JoinedChannels[I]; bool SendToThisChannel = (mt.HasFlag(ChatMessageType.AdminInfo) && IRCConfig.AdminChannels.Contains(cid)) || (mt.HasFlag(ChatMessageType.DeveloperInfo) && IRCConfig.DevChannels.Contains(cid)) || (mt.HasFlag(ChatMessageType.GameInfo) && IRCConfig.GameChannels.Contains(cid)) || (mt.HasFlag(ChatMessageType.WatchdogInfo) && IRCConfig.WatchdogChannels.Contains(cid)); if (SendToThisChannel) - irc.SendMessage(SendType.Message, cid, message); + cids += I > 0 ? ',' + cid : cid; } + irc.SendMessage(SendType.Message, cids, message); } } From 83f40c7ca3caf220d06759042d1e8bbff4055172 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 21 Oct 2017 18:11:44 -0400 Subject: [PATCH 3/3] Version bump to 3.1.5.1 [TGSDeploy] --- Version.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Version.cs b/Version.cs index 4ee176030a..87f3405212 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.0")] -[assembly: AssemblyFileVersion("3.1.5.0")] -[assembly: AssemblyInformationalVersion("3.1.5.0")] +[assembly: AssemblyVersion("3.1.5.1")] +[assembly: AssemblyFileVersion("3.1.5.1")] +[assembly: AssemblyInformationalVersion("3.1.5.1")]