From 7bf0caef9fae86a34719f04f7b9926095fb6a146 Mon Sep 17 00:00:00 2001 From: indexzero Date: Thu, 19 May 2011 00:37:18 -0400 Subject: [PATCH] [fix] Change variable references for Websockets, bugs found from using wsbench --- lib/node-http-proxy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node-http-proxy.js b/lib/node-http-proxy.js index e8a337424..d95bfdd4e 100644 --- a/lib/node-http-proxy.js +++ b/lib/node-http-proxy.js @@ -579,10 +579,10 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options // Detach event listeners from reverseProxy function detach() { - reverseProxy.removeListener('close', listeners._r_close); + reverseProxy.removeListener('end', listeners._r_close); reverseProxy.removeListener('data', listeners._r_data); out.incoming.socket.removeListener('data', listeners._data); - out.incoming.socket.removeListener('close', listeners._close); + out.incoming.socket.removeListener('end', listeners._close); } // Hook disconnections @@ -591,7 +591,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options detach(); }); - socket.on('end', listeners._close = function() { + out.incoming.socket.on('end', listeners._close = function() { reverseProxy.end(); detach(); });