Merge pull request #237 from nogueian/develop

Fixed issue with logic to detect if IPFS node is online
This commit is contained in:
Iuri Matias 2017-03-08 20:34:20 -05:00 committed by GitHub
commit 02cb5b7f1f

View File

@ -70,18 +70,23 @@ ServicesMonitor.prototype.check = function() {
body += d;
});
res.on('end', function() {
var parsed = JSON.parse(body);
if(parsed.Version){
result.push(("IPFS " + parsed.Version).green);
try{
var parsed = JSON.parse(body);
if(parsed.Version){
result.push(("IPFS " + parsed.Version).green);
}
else{
result.push("IPFS".green);
}
}
else{
result.push("IPFS".green);
catch (e){
result.push("IPFS".red);
}
callback(null, result);
});
res.on('error', function(err) {
self.logger.trace("Check IPFS version error: " + err);
result.push("IPFS".green);
result.push("IPFS".red);
callback(null, result);
});
});