Commit 0eae2a91 authored by indexzero's avatar indexzero

[api] Added new `close()` method which cleans up sockets from HttpProxy instances

parent ec03d72c
......@@ -662,6 +662,21 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
}
};
//
// ### function close()
// Closes all sockets associated with the Agents
// belonging to this instance.
//
HttpProxy.prototype.close = function () {
[this.forward, this.target].forEach(function (proxy) {
if (proxy.agent) {
proxy.agent.sockets.forEach(function (socket) {
socket.end();
});
}
});
};
//
// ### @private function _forwardRequest (req)
// #### @req {ServerRequest} Incoming HTTP Request to proxy.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment