From eb8907e1a9761e9b41363cd95c17331b4af3eb96 Mon Sep 17 00:00:00 2001 From: Brice Carpentier Date: Thu, 27 Feb 2014 10:27:43 +0100 Subject: [PATCH] fixed #12 JobManager's newBlock event never gets emitted The `init` function does not auto-execute anymore. It is instead added as a public member for `DaemonInterface` and called by `Pool.SetupDaemonInterface`. --- lib/daemon.js | 5 +++-- lib/pool.js | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/daemon.js b/lib/daemon.js index bfc0ea6..af7372c 100644 --- a/lib/daemon.js +++ b/lib/daemon.js @@ -26,12 +26,12 @@ function DaemonInterface(options){ })(); - (function init(){ + function init(){ isOnline(function(online){ if (online) _this.emit('online'); }); - })(); + }; function isOnline(callback){ cmd('getinfo', [], function(error, result){ @@ -110,6 +110,7 @@ function DaemonInterface(options){ //public members + this.init = init; this.isOnline = isOnline; this.cmd = cmd; } diff --git a/lib/pool.js b/lib/pool.js index 22b476b..d7f508b 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -279,6 +279,8 @@ var pool = module.exports = function pool(options, authorizeFn){ }).on('error', function(message){ emitErrorLog('system', message); }); + + _this.daemon.init(); }