rebase interactor

This commit is contained in:
Unitech 2014-11-16 22:46:17 +01:00
parent 4b92b3d682
commit 9e48f18c35

View File

@ -49,19 +49,31 @@ InteractorDaemonizer.ping = function(cb) {
};
InteractorDaemonizer.killDaemon = function(cb) {
InteractorDaemonizer.launchRPC(function(err, data) {
if (err) {
setTimeout(function() {
InteractorDaemonizer.disconnectRPC(cb);
}, 100);
return false;
debug('Killing interactor #1 ping');
InteractorDaemonizer.ping(function(online) {
debug('Interactor online', online);
if (!online) {
if (!cb) Common.printError('Interactor not launched');
return cb ? cb({msg:'Interactor not launched'}) : Common.exitCli(cst.SUCCESS_EXIT);
}
InteractorDaemonizer.rpc.kill(function(err) {
if (err) Common.printError(err);
setTimeout(function() {
InteractorDaemonizer.disconnectRPC(cb);
}, 100);
InteractorDaemonizer.launchRPC(function(err, data) {
if (err) {
setTimeout(function() {
InteractorDaemonizer.disconnectRPC(cb);
}, 100);
return false;
}
InteractorDaemonizer.rpc.kill(function(err) {
if (err) Common.printError(err);
setTimeout(function() {
InteractorDaemonizer.disconnectRPC(cb);
}, 100);
});
return false;
});
return false;
});
};