From eb9afb9733b7a32c9098a15bd58bc8ba371be8ff Mon Sep 17 00:00:00 2001 From: cirospaciari Date: Fri, 18 Oct 2024 03:51:07 -0700 Subject: [PATCH] cleanup after close --- src/bun.js/api/bun/socket.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bun.js/api/bun/socket.zig b/src/bun.js/api/bun/socket.zig index 535b535e6a584..1c94bf50b1eb3 100644 --- a/src/bun.js/api/bun/socket.zig +++ b/src/bun.js/api/bun/socket.zig @@ -1838,7 +1838,7 @@ fn NewSocket(comptime ssl: bool) type { this.detachNativeCallback(); this.socket.detach(); defer this.deref(); - defer this.markInactive(); + defer this.cleanup(); if (this.flags.finalizing) { return; @@ -2323,7 +2323,7 @@ fn NewSocket(comptime ssl: bool) type { return JSValue.jsUndefined(); } - pub fn deinit(this: *This) void { + pub fn cleanup(this: *This) void { this.markInactive(); this.detachNativeCallback(); @@ -2349,6 +2349,9 @@ fn NewSocket(comptime ssl: bool) type { this.socket_context = null; socket_context.deinit(ssl); } + } + pub fn deinit(this: *This) void { + this.cleanup(); this.destroy(); }