Skip to content

Commit

Permalink
Add callback for close API
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceK33z committed Sep 24, 2016
1 parent 943e024 commit 1cf6549
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Server.js
Expand Up @@ -380,13 +380,14 @@ Server.prototype.listen = function() {
return returnValue;
}

Server.prototype.close = function() {
Server.prototype.close = function(callback) {
this.sockets.forEach(function(sock) {
sock.close();
});
this.sockets = [];
this.middleware.close();
this.listeningApp.close();
this.listeningApp.close(function() {
this.middleware.close(callback);
}.bind(this));
}

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

0 comments on commit 1cf6549

Please sign in to comment.