diff options
-rw-r--r-- | src/bun.js/api/bun.zig | 2 | ||||
-rw-r--r-- | src/http/websocket_http_client.zig | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/bun.js/api/bun.zig b/src/bun.js/api/bun.zig index 5c8bfbb0e..7044b9258 100644 --- a/src/bun.js/api/bun.zig +++ b/src/bun.js/api/bun.zig @@ -2202,6 +2202,8 @@ pub const Timer = struct { last_id: i32 = 1, warned: bool = false, + // We split up the map here to avoid storing an extra "repeat" boolean + /// Used by setTimeout() timeout_map: TimeoutMap = TimeoutMap{}, diff --git a/src/http/websocket_http_client.zig b/src/http/websocket_http_client.zig index 2dfed4d7a..b1b4eea4b 100644 --- a/src/http/websocket_http_client.zig +++ b/src/http/websocket_http_client.zig @@ -790,6 +790,7 @@ pub fn NewWebSocketClient(comptime ssl: bool) type { } pub fn clearData(this: *WebSocket) void { + this.poll_ref.unref(this.globalThis.bunVM()); this.clearReceiveBuffers(true); this.clearSendBuffers(true); this.ping_len = 0; @@ -1371,6 +1372,7 @@ pub fn NewWebSocketClient(comptime ssl: bool) type { fn dispatchClose(this: *WebSocket) void { var out = this.outgoing_websocket orelse return; + this.poll_ref.unref(this.globalThis.bunVM()); JSC.markBinding(); WebSocket__didCloseWithErrorCode(out, ErrorCode.closed); } @@ -1459,8 +1461,6 @@ pub fn NewWebSocketClient(comptime ssl: bool) type { pub fn finalize(this: *WebSocket) callconv(.C) void { this.clearData(); - this.poll_ref.unref(this.globalThis.bunVM()); - this.outgoing_websocket = null; if (this.tcp.isClosed()) |