diff --git a/index.js b/index.js index ddd262d..00c5f4a 100644 --- a/index.js +++ b/index.js @@ -61,7 +61,19 @@ Main.prototype.createMaster = function(callback) { }; Main.prototype.stop = function(callback) { - throw new Error('stop() not implemented on server. TODO.'); + var self = this; + + if (self.workers) { + _.each(self.workers, function(child) { + child.destroy(); // send suicide signal + }); + } + + self.server.on("close", function() { + callback(); + }); + + self.server.close(); }; Main.prototype.start = function(callback) {