From 9a6e68fb0ba00be82f80ed0e75da54df56b2c0b3 Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Fri, 7 Jun 2024 01:07:27 +0530 Subject: [PATCH] Revert "...reduce gc to reduce blocking lag??" This reverts commit f64efc3a6b40f63e3a98102b53201d7389ce62d8. --- src/net/MasterServerClient.hx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/net/MasterServerClient.hx b/src/net/MasterServerClient.hx index 34fc6b1d..d9e511c5 100644 --- a/src/net/MasterServerClient.hx +++ b/src/net/MasterServerClient.hx @@ -44,6 +44,8 @@ class MasterServerClient { public function new(onOpenFunc:() -> Void, onErrorFunc:() -> Void) { #if hl wsThread = sys.thread.Thread.create(() -> { + hl.Gc.enable(false); + hl.Gc.blocking(true); // Wtf is this shit #end wsToken++; @@ -51,6 +53,8 @@ class MasterServerClient { ws = WebSocket.create(serverIp); #if hl + hl.Gc.enable(true); + hl.Gc.blocking(false); #end ws.onopen = () -> { open = true; @@ -127,10 +131,22 @@ class MasterServerClient { var s = toSend.pop(false); if (s == null) break; + #if hl + hl.Gc.blocking(true); + #end ws.sendString(s); + #if hl + hl.Gc.blocking(false); + #end } + #if hl + hl.Gc.blocking(true); + #end ws.process(); + #if hl + hl.Gc.blocking(false); + #end stopMutex.release(); Sys.sleep(0.1); }