fix callback order.
This commit is contained in:
parent
7f7ef196f4
commit
a9d124c058
@ -35,17 +35,6 @@ Bitcoin.prototype.start = function(callback) {
|
|||||||
var errorCaught = none;
|
var errorCaught = none;
|
||||||
|
|
||||||
this.log_pipe = bitcoindjs.start(function(err, status) {
|
this.log_pipe = bitcoindjs.start(function(err, status) {
|
||||||
if (callback) {
|
|
||||||
callback(err);
|
|
||||||
callback = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err) {
|
|
||||||
self.emit('error', err);
|
|
||||||
} else {
|
|
||||||
self.emit('open', status);
|
|
||||||
}
|
|
||||||
|
|
||||||
process.on('SIGINT', self.stop.bind(self));
|
process.on('SIGINT', self.stop.bind(self));
|
||||||
process.on('SIGHUP', self.stop.bind(self));
|
process.on('SIGHUP', self.stop.bind(self));
|
||||||
|
|
||||||
@ -69,6 +58,17 @@ Bitcoin.prototype.start = function(callback) {
|
|||||||
}
|
}
|
||||||
self.stop();
|
self.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (callback) {
|
||||||
|
callback(err);
|
||||||
|
callback = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
self.emit('error', err);
|
||||||
|
} else {
|
||||||
|
self.emit('open', status);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// bitcoind's boost threads aren't in the thread pool
|
// bitcoind's boost threads aren't in the thread pool
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user