Skip to content

Commit

Permalink
cleanup after close
Browse files Browse the repository at this point in the history
  • Loading branch information
cirospaciari committed Oct 18, 2024
1 parent 08c5062 commit eb9afb9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bun.js/api/bun/socket.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand All @@ -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();
}

Expand Down

0 comments on commit eb9afb9

Please sign in to comment.