mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
updated close function for safety
This commit is contained in:
parent
a3d02196c5
commit
8be9d945d0
@ -134,8 +134,16 @@ ProxyServer.prototype.listen = function(port, hostname) {
|
|||||||
|
|
||||||
ProxyServer.prototype.close = function(callback) {
|
ProxyServer.prototype.close = function(callback) {
|
||||||
if (this._server) {
|
if (this._server) {
|
||||||
this._server.close(callback);
|
// Wrap callback to nullify server after all open connections are closed.
|
||||||
this._server = null;
|
var callback_wrapper = function() {
|
||||||
|
this._server = null;
|
||||||
|
|
||||||
|
if (callback) {
|
||||||
|
callback(arguments);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this._server.close(callback_wrapper);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user