mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] destroy() websockets in case of an error
Not doing so caused websockets in `CLOSE_WAIT` to pile up and cause proxy to exceed open file descriptor limit.
This commit is contained in:
parent
13c34d09b2
commit
0d00b06af3
@ -611,12 +611,17 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
|
|||||||
// connections.
|
// connections.
|
||||||
//
|
//
|
||||||
function proxyError (err) {
|
function proxyError (err) {
|
||||||
reverseProxy.end();
|
reverseProxy.destroy();
|
||||||
if (self.emit('webSocketProxyError', req, socket, head)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.end();
|
process.nextTick(function () {
|
||||||
|
//
|
||||||
|
// Destroy the incoming socket in the next tick, in case the error handler
|
||||||
|
// wants to write to it.
|
||||||
|
//
|
||||||
|
socket.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
|
self.emit('webSocketProxyError', req, socket, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user