Socket
Socket
Sign inDemoInstall

thsq-agent

Package Overview
Dependencies
134
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.18 to 1.1.19

2

package.json
{
"name": "thsq-agent",
"version": "1.1.18",
"version": "1.1.19",
"description": "Thingsquare agent for Linux gateways",

@@ -5,0 +5,0 @@ "main": "thsq-agent.js",

@@ -63,4 +63,4 @@ /*jslint nomen: true, node: true */

if (dvar && dvar !== '') {
currentDns = dvar;
if (dvar && dvar.toString() !== '') {
currentDns = dvar.toString();
logmsg = 'd.dns: ' + currentDns;

@@ -67,0 +67,0 @@ } else if (process.env.THSQ_AGENT_DNS) {

@@ -170,5 +170,22 @@ #!/usr/bin/env node

if (agent.d.getVariable('verbose') && agent.d.getVariable('verbose') !== String(options.verbose)) {
console.info('Setting new verbose option from d.verbose', agent.d.getVariable('verbose'), 'previous was', options.verbose);
if (agent.d.getVariable('verbose') === String(true)) {
function getVariableString(key) {
var val = agent.d.getVariable(key);
if (val && typeof val === 'object') {
val = val.toString();
}
return val;
}
function getVariableNumber(key) {
var val = getVariableString(key);
if (val) {
val = Number(val);
if (!Number.isNaN(val)) {
return val;
}
}
}
if (getVariableString('verbose') && getVariableString('verbose') !== String(options.verbose)) {
console.info('Setting new verbose option from d.verbose', getVariableString('verbose'), 'previous was', options.verbose);
if (getVariableString('verbose') === String(true)) {
options.verbose = true;

@@ -181,6 +198,4 @@ } else {

var watchdog;
if (agent.d.getVariable('watchdog') && agent.d.getVariable('watchdog') !== options.watchdog) {
var watchdogVariable = getVariableNumber('watchdog');
if (watchdogVariable && watchdogVariable !== options.watchdog) {
/* If we have a d.watchdog variable, but it is different from

@@ -190,25 +205,15 @@ what we have via options.watchdog, we use the d.watchdog

if (options.verbose) {
console.info('Setting new watchdog from d.watchdog', agent.d.getVariable('watchdog'), 'previous was', options.watchdog);
console.info('Setting new watchdog from d.watchdog', watchdogVariable, 'previous was', options.watchdog);
}
options.watchdog = agent.d.getVariable('watchdog');
options.watchdog = watchdogVariable;
saveoptions();
}
if (options.watchdog) {
/* If we have a watchdog configured as part of the configuration options, we use that. */
watchdog = options.watchdog;
} else {
/* Otherwise, we use the d variable d.watchdog to configure the watchdog */
watchdog = agent.d.getVariable('watchdog');
}
if (watchdog) {
var disconnected = new Date().getTime() - lastconnected.getTime();
if (disconnected > 0) {
if (disconnected > watchdog * 60 * 1000) {
if (disconnected > options.watchdog * 60 * 1000) {
if (options.verbose) {
console.info('Rebooting because of watchdog, last connected was', disconnected, 'ms, watchdog is', watchdog * 1000 * 60, 'ms. Issuing command:',
console.info('Rebooting because of watchdog, last connected was', disconnected, 'ms, watchdog is', options.watchdog * 1000 * 60, 'ms. Issuing command:',
options.watchdogcommand);

@@ -221,5 +226,5 @@ }

}
if (disconnected > watchdog * 60 * 1000 / 2) {
if (disconnected > options.watchdog * 60 * 1000 / 2) {
if (options.verbose) {
console.info('Rebooting in ' + (watchdog * 60 * 1000 - disconnected) + ' ms because of watchdog, last connected was', disconnected, 'ms, watchdog is', watchdog * 1000 * 60, 'ms. watchdog command:', options.watchdogcommand);
console.info('Rebooting in ' + (options.watchdog * 60 * 1000 - disconnected) + ' ms because of watchdog, last connected was', disconnected, 'ms, watchdog is', options.watchdog * 1000 * 60, 'ms. watchdog command:', options.watchdogcommand);
}

@@ -226,0 +231,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc