From b13674aa72c9d0f3ba52213761e8cac834929f47 Mon Sep 17 00:00:00 2001 From: Van Nguyen Date: Thu, 29 Mar 2012 11:50:16 -0700 Subject: [PATCH] fix for Object # has no method 'destroy' --- lib/util.js | 2 +- nodeload.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util.js b/lib/util.js index f957d0f..507f465 100644 --- a/lib/util.js +++ b/lib/util.js @@ -104,7 +104,7 @@ util.createReconnectingClient = function() { clientSetter = function(member) { return function(val) { client[member] = val; };}, reconnect = function() { var oldclient = client; - if (oldclient) { oldclient.destroy(); } + if (oldclient && oldclient.destroy) { oldclient.destroy(); } client = http.createClient.apply(http, clientArgs); client._events = util.extend(events, client._events); // EventEmitter._events stores event handlers client.emit('reconnect', oldclient); diff --git a/nodeload.js b/nodeload.js index 51cce8f..7935ca4 100755 --- a/nodeload.js +++ b/nodeload.js @@ -6,7 +6,7 @@ var qputs=util.qputs=function(s){if(!NODELOAD_CONFIG.QUIET){util.puts(s);}};var return obj;};util.extend=function(obj,extension){for(var i in extension){if(extension.hasOwnProperty(i)){obj[i]=extension[i];}} return obj;};util.forEach=function(obj,f){for(var i in obj){if(obj.hasOwnProperty(i)){f(i,obj[i]);}}};util.every=function(obj,f){for(var i in obj){if(obj.hasOwnProperty(i)){if(!f(i,obj[i])){return false;}}} return true;};util.argarray=function(args){return Array.prototype.slice.call(args);};util.readStream=function(stream,callback){var data=[];stream.on('data',function(chunk){data.push(chunk.toString());});stream.on('end',function(){callback(data.join(''));});};util.PeriodicUpdater=function(updateIntervalMs){var self=this,updateTimeoutId;this.__defineGetter__('updateInterval',function(){return updateIntervalMs;});this.__defineSetter__('updateInterval',function(milliseconds){clearInterval(updateTimeoutId);if(milliseconds>0&&milliseconds