diff --git a/index.js b/index.js index e6f6dc9..fd64cbc 100644 --- a/index.js +++ b/index.js @@ -182,6 +182,11 @@ function createFastCGIHandler(options) { if (typeof socket !== "undefined") { socket.removeListener("data", fastCGISocketHandler); processFastCGIPacket = function() {}; + try { + socket.end(); //Fixes connection not closing properly in Bun + } catch (err) { + //It is already closed + } } var appStatus = processedPacket.content.readUInt32BE(0); var protocolStatus = processedPacket.content.readUInt8(4);