We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a3d0219 commit 8be9d94Copy full SHA for 8be9d94
lib/http-proxy/index.js
@@ -134,8 +134,16 @@ ProxyServer.prototype.listen = function(port, hostname) {
134
135
ProxyServer.prototype.close = function(callback) {
136
if (this._server) {
137
- this._server.close(callback);
138
- this._server = null;
+ // Wrap callback to nullify server after all open connections are closed.
+ var callback_wrapper = function() {
139
+ this._server = null;
140
+
141
+ if (callback) {
142
+ callback(arguments);
143
+ }
144
+ };
145
146
+ this._server.close(callback_wrapper);
147
}
148
};
149
0 commit comments