From 3fed6df2afb17efd9f7b028e204795924da93406 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Tue, 3 Jan 2012 13:16:07 -0800 Subject: [PATCH] Fixed Socket#close and added close reason --- lib/socket.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/socket.js b/lib/socket.js index 0ec08805..751dab46 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -334,12 +334,9 @@ Socket.prototype.sendPacket = function (type, data) { Socket.prototype.close = function () { if ('opening' == this.readyState || 'open' == this.readyState) { - if (this.transport) { - // debug: socket closing - telling transport to close - this.transport.close(); - } - - this.onClose(); + this.onClose('forced close'); + // debug: socket closing - telling transport to close + this.transport.close(); } return this;