From 82042c01c6f5d322438244409cd6c6297ab0ab73 Mon Sep 17 00:00:00 2001 From: Andy Nogueira Date: Wed, 8 Mar 2017 09:46:15 -0500 Subject: [PATCH 1/2] Fixed issue with logic to detect if IPFS node is online. If the IPFS node is not running and there's another service in the computer running on port 5001 it could cause an exception. --- lib/core/services.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/core/services.js b/lib/core/services.js index a04f672eb..ad2f8c078 100644 --- a/lib/core/services.js +++ b/lib/core/services.js @@ -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); }); }); @@ -93,8 +98,8 @@ ServicesMonitor.prototype.check = function() { }); }, function checkDevServer(result, callback) { - var host = self.serverHost || self.config.webServerConfig.host; - var port = self.serverPort || self.config.webServerConfig.port; + var host = self.config.webServerConfig.host || self.serverHost; + var port = self.config.webServerConfig.port || self.serverPort; self.logger.trace('checkDevServer'); var devServer = 'Webserver (http://' + host + ':' + port + ')'; devServer = (self.runWebserver) ? devServer.green : devServer.red; From f5aafa424220a2d95bfc947e752aa562d121a52b Mon Sep 17 00:00:00 2001 From: Andy Nogueira Date: Wed, 8 Mar 2017 09:51:58 -0500 Subject: [PATCH 2/2] Setting host and port parameters back according to develop branch --- lib/core/services.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core/services.js b/lib/core/services.js index ad2f8c078..90fb5e0b8 100644 --- a/lib/core/services.js +++ b/lib/core/services.js @@ -98,8 +98,8 @@ ServicesMonitor.prototype.check = function() { }); }, function checkDevServer(result, callback) { - var host = self.config.webServerConfig.host || self.serverHost; - var port = self.config.webServerConfig.port || self.serverPort; + var host = self.serverHost || self.config.webServerConfig.host; + var port = self.serverPort || self.config.webServerConfig.port; self.logger.trace('checkDevServer'); var devServer = 'Webserver (http://' + host + ':' + port + ')'; devServer = (self.runWebserver) ? devServer.green : devServer.red;