handle SIGINT

This commit is contained in:
Manuel Araoz 2015-04-07 15:50:13 -03:00
parent 5c3e007e38
commit 1cd51ef944
2 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,10 @@ if (require.main === module) {
console.log('Error: ', err);
}
});
process.on('SIGINT', function() {
node.stop();
process.exit();
});
var reporterName = config.get('Reporter');
var reporter = reporters[reporterName];

View File

@ -86,6 +86,11 @@ BitcoreNode.prototype.start = function() {
this.networkMonitor.start();
};
BitcoreNode.prototype.stop = function() {
this.networkMonitor.stop();
};
BitcoreNode.prototype.sync = function() {
var genesis = bitcore.Block.fromBuffer(genesisBlocks[bitcore.Networks.defaultNetwork.name]);
var self = this;