mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
more gc blocking
This commit is contained in:
parent
0dc21e577a
commit
d681c2aa5f
2 changed files with 22 additions and 2 deletions
|
|
@ -26,17 +26,26 @@ class MasterServerClient {
|
||||||
|
|
||||||
#if hl
|
#if hl
|
||||||
var wsThread:sys.thread.Thread;
|
var wsThread:sys.thread.Thread;
|
||||||
|
|
||||||
static var responses:sys.thread.Deque<() -> Void> = new sys.thread.Deque<() -> Void>();
|
static var responses:sys.thread.Deque<() -> Void> = new sys.thread.Deque<() -> Void>();
|
||||||
|
|
||||||
var toSend:sys.thread.Deque<String> = new sys.thread.Deque<String>();
|
var toSend:sys.thread.Deque<String> = new sys.thread.Deque<String>();
|
||||||
var stopping:Bool = false;
|
var stopping:Bool = false;
|
||||||
var stopMutex: sys.thread.Mutex = new sys.thread.Mutex();
|
var stopMutex:sys.thread.Mutex = new sys.thread.Mutex();
|
||||||
#end
|
#end
|
||||||
|
|
||||||
public function new(onOpenFunc:() -> Void) {
|
public function new(onOpenFunc:() -> Void) {
|
||||||
#if hl
|
#if hl
|
||||||
wsThread = sys.thread.Thread.create(() -> {
|
wsThread = sys.thread.Thread.create(() -> {
|
||||||
|
hl.Gc.enable(false);
|
||||||
|
hl.Gc.blocking(true); // Wtf is this shit
|
||||||
#end
|
#end
|
||||||
|
|
||||||
ws = WebSocket.create(serverIp);
|
ws = WebSocket.create(serverIp);
|
||||||
|
#if hl
|
||||||
|
hl.Gc.enable(true);
|
||||||
|
hl.Gc.blocking(false);
|
||||||
|
#end
|
||||||
ws.onopen = () -> {
|
ws.onopen = () -> {
|
||||||
open = true;
|
open = true;
|
||||||
#if hl
|
#if hl
|
||||||
|
|
@ -98,10 +107,22 @@ class MasterServerClient {
|
||||||
var s = toSend.pop(false);
|
var s = toSend.pop(false);
|
||||||
if (s == null)
|
if (s == null)
|
||||||
break;
|
break;
|
||||||
|
#if hl
|
||||||
|
hl.Gc.blocking(true);
|
||||||
|
#end
|
||||||
ws.sendString(s);
|
ws.sendString(s);
|
||||||
|
#if hl
|
||||||
|
hl.Gc.blocking(false);
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if hl
|
||||||
|
hl.Gc.blocking(true);
|
||||||
|
#end
|
||||||
ws.process();
|
ws.process();
|
||||||
|
#if hl
|
||||||
|
hl.Gc.blocking(false);
|
||||||
|
#end
|
||||||
stopMutex.release();
|
stopMutex.release();
|
||||||
Sys.sleep(0.1);
|
Sys.sleep(0.1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ class Net {
|
||||||
"stun:stun2.l.google.com:19302",
|
"stun:stun2.l.google.com:19302",
|
||||||
"stun:stun3.l.google.com:19302",
|
"stun:stun3.l.google.com:19302",
|
||||||
"stun:stun4.l.google.com:19302",
|
"stun:stun4.l.google.com:19302",
|
||||||
"stun:relay.metered.ca:80",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public static var turnServer:String = "";
|
public static var turnServer:String = "";
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue