aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/api/bun/socket.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/api/bun/socket.zig')
-rw-r--r--src/bun.js/api/bun/socket.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bun.js/api/bun/socket.zig b/src/bun.js/api/bun/socket.zig
index fa4411cc0..8fd6621f2 100644
--- a/src/bun.js/api/bun/socket.zig
+++ b/src/bun.js/api/bun/socket.zig
@@ -885,8 +885,10 @@ fn NewSocket(comptime ssl: bool) type {
.syscall = ZigString.init("connect"),
};
_ = handlers.rejectPromise(err.toErrorInstance(handlers.globalObject));
- this.reffer.unref(handlers.vm);
- handlers.markInactive(ssl, socket.context());
+ if (this.reffer.has) {
+ this.reffer.unref(handlers.vm);
+ handlers.markInactive(ssl, socket.context());
+ }
}
pub fn markActive(this: *This) void {