diff --git a/RageCoop.Client/Networking/Networking.cs b/RageCoop.Client/Networking/Networking.cs index cbca6fa..44b798f 100644 --- a/RageCoop.Client/Networking/Networking.cs +++ b/RageCoop.Client/Networking/Networking.cs @@ -23,7 +23,6 @@ namespace RageCoop.Client if (Client!=null) { ProcessMessage(Client.WaitMessage(200)); - Client.FlushSendQueue(); } else { @@ -46,7 +45,7 @@ namespace RageCoop.Client // 623c92c287cc392406e7aaaac1c0f3b0 = RAGECOOP NetPeerConfiguration config = new NetPeerConfiguration("623c92c287cc392406e7aaaac1c0f3b0") { - AutoFlushSendQueue = true + AutoFlushSendQueue = false }; config.EnableMessageType(NetIncomingMessageType.ConnectionLatencyUpdated); diff --git a/RageCoop.Client/Scripting/Resources.cs b/RageCoop.Client/Scripting/Resources.cs index afbb62b..c1e27e8 100644 --- a/RageCoop.Client/Scripting/Resources.cs +++ b/RageCoop.Client/Scripting/Resources.cs @@ -142,6 +142,8 @@ namespace RageCoop.Client.Scripting rFile.GetStream=() => { return file.GetInputStream(entry); }; if (entry.Name.EndsWith(".dll") && !entry.Name.Contains("/")) { + // Don't load API assembly + if (Path.GetFileName(entry.Name).CanBeIgnored()) { continue; } var tmp = Path.GetTempFileName(); var f = File.OpenWrite(tmp); rFile.GetStream().CopyTo(f); diff --git a/RageCoop.Client/Sync/EntityPool.cs b/RageCoop.Client/Sync/EntityPool.cs index 0f88c10..8103955 100644 --- a/RageCoop.Client/Sync/EntityPool.cs +++ b/RageCoop.Client/Sync/EntityPool.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; +using System.Threading; namespace RageCoop.Client { @@ -560,6 +561,7 @@ namespace RageCoop.Client #endif } + ThreadPool.QueueUserWorkItem((o) => { Networking.Client.FlushSendQueue(); }); } diff --git a/RageCoop.Core/CoreUtils.cs b/RageCoop.Core/CoreUtils.cs index 31e99ac..abc04b4 100644 --- a/RageCoop.Core/CoreUtils.cs +++ b/RageCoop.Core/CoreUtils.cs @@ -13,9 +13,20 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("RageCoop.Client")] namespace RageCoop.Core { - internal class CoreUtils + internal static class CoreUtils { - + private static readonly HashSet ToIgnore = new HashSet() + { + "RageCoop.Client.dll", + "RageCoop.Core.dll", + "RageCoop.Server.dll", + "ScriptHookVDotNet3.dll", + "ScriptHookVDotNet.dll" + }; + public static bool CanBeIgnored(this string name) + { + return ToIgnore.Contains(name); + } public static (byte, byte[]) GetBytesFromObject(object obj) { switch (obj) diff --git a/RageCoop.Server/Scripting/ServerResource.cs b/RageCoop.Server/Scripting/ServerResource.cs index dfe9768..29e4aa6 100644 --- a/RageCoop.Server/Scripting/ServerResource.cs +++ b/RageCoop.Server/Scripting/ServerResource.cs @@ -15,14 +15,7 @@ namespace RageCoop.Server.Scripting /// public class ServerResource : PluginLoader { - private static readonly HashSet ToIgnore = new() - { - "RageCoop.Client.dll", - "RageCoop.Core.dll", - "RageCoop.Server.dll", - "ScriptHookVDotNet3.dll", - "ScriptHookVDotNet.dll" - }; + internal ServerResource(PluginConfig config) : base(config) { } internal static ServerResource LoadFrom(string resDir, string dataFolder, Logger logger = null, bool isTemp = false) { @@ -57,7 +50,7 @@ namespace RageCoop.Server.Scripting var assemblies=new Dictionary(); foreach (var file in Directory.GetFiles(resDir, "*", SearchOption.AllDirectories)) { - if (ToIgnore.Contains(Path.GetFileName(file))) { try { File.Delete(file); } catch { } continue; } + if (Path.GetFileName(file).CanBeIgnored()) { try { File.Delete(file); } catch { } continue; } var relativeName = file.Substring(resDir.Length+1).Replace('\\', '/'); var rfile = new ResourceFile() {