diff options
Diffstat (limited to 'src/http/websocket_http_client.zig')
-rw-r--r-- | src/http/websocket_http_client.zig | 4 |
1 files changed, 2 insertions, 2 deletions
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()) |