Skip to content

Commit 1cf6549

Browse files
committed
Add callback for close API
1 parent 943e024 commit 1cf6549

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/Server.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,14 @@ Server.prototype.listen = function() {
380380
return returnValue;
381381
}
382382

383-
Server.prototype.close = function() {
383+
Server.prototype.close = function(callback) {
384384
this.sockets.forEach(function(sock) {
385385
sock.close();
386386
});
387387
this.sockets = [];
388-
this.middleware.close();
389-
this.listeningApp.close();
388+
this.listeningApp.close(function() {
389+
this.middleware.close(callback);
390+
}.bind(this));
390391
}
391392

392393
Server.prototype.sockWrite = function(sockets, type, data) {

0 commit comments

Comments
 (0)