From c1122d65e69bddf3fdff697aef64b92156d7b87d Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sun, 28 Jul 2024 19:29:58 -0700 Subject: [PATCH] Don't call the onTimeout handler if the socket is closed, shutdown, or detached --- src/bun.js/api/bun/socket.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bun.js/api/bun/socket.zig b/src/bun.js/api/bun/socket.zig index 23e28c773e..4e85baf2b3 100644 --- a/src/bun.js/api/bun/socket.zig +++ b/src/bun.js/api/bun/socket.zig @@ -1296,7 +1296,7 @@ fn NewSocket(comptime ssl: bool) type { ) void { JSC.markBinding(@src()); log("onTimeout", .{}); - if (this.detached) return; + if (this.detached or this.socket.isShutdown() or this.socket.isClosed()) return; const handlers = this.handlers; const callback = handlers.onTimeout;