diff options
Diffstat (limited to 'src/javascript/jsc/api/server.zig')
-rw-r--r-- | src/javascript/jsc/api/server.zig | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/javascript/jsc/api/server.zig b/src/javascript/jsc/api/server.zig index 9a9628094..711329a95 100644 --- a/src/javascript/jsc/api/server.zig +++ b/src/javascript/jsc/api/server.zig @@ -1523,6 +1523,7 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type { if (this.listener) |listener| { listener.close(); this.listener = null; + this.vm.disable_run_us_loop = false; } this.deinitIfWeCan(); @@ -1535,11 +1536,6 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type { } } - // if you run multiple servers simultaneously, this could break it - if (this.vm.uws_event_loop != null and uws.Loop.get().? == this.vm.uws_event_loop.?) { - this.vm.uws_event_loop = null; - } - this.app.destroy(); const allocator = this.allocator; allocator.destroy(this); @@ -1646,6 +1642,12 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type { pub fn run(this: *ThisServer) void { // this.app.addServerName(hostname_pattern: [*:0]const u8) + + // we do not increment the reference count here + // uWS manages running the loop, so it is unnecessary + // this.vm.us_loop_reference_count +|= 1; + this.vm.disable_run_us_loop = true; + this.app.run(); } |