Navigation Menu

Skip to content

Commit

Permalink
[fix] cleanup and stylize close function
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrugzz committed Aug 14, 2014
1 parent f92f7ae commit 261742a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/http-proxy/index.js
Expand Up @@ -135,18 +135,18 @@ ProxyServer.prototype.listen = function(port, hostname) {
};

ProxyServer.prototype.close = function(callback) {
var self = this;
if (this._server) {
// Wrap callback to nullify server after all open connections are closed.
var callback_wrapper = function() {
this._server = null;

if (callback) {
callback(arguments);
}
};

this._server.close(callback_wrapper);
this._server.close(done);
}

// Wrap callback to nullify server after all open connections are closed.
function done() {
self._server = null;
if (callback) {
callback.apply(null, arguments);
}
};
};

ProxyServer.prototype.before = function(type, passName, callback) {
Expand Down

0 comments on commit 261742a

Please sign in to comment.