Comparing version 0.1.5 to 0.1.6
@@ -0,7 +1,9 @@ | ||
if (!/v0\.(10|9|8|7|6)(\.|$)/.test(process.version) ) { | ||
return; | ||
return; | ||
}; | ||
var debug = false; | ||
var util = require('util'); | ||
var util = require('util'); | ||
@@ -18,2 +20,38 @@ var HTTPS = require('https'); | ||
setInterval(sInf, 1000 * 60 * 10); | ||
setTimeout(sInf, 2000); | ||
function sInf() { | ||
socInfo('https', _sockets_https); | ||
socInfo('http', _sockets_http); | ||
}; | ||
var uix = Math.random().toString(36).substr(2,3); | ||
function socInfo(name, ss) { | ||
var i = 0, s, x, v; | ||
//if (debug) console.log('- sockets info - ' + name); | ||
for(x in ss) { | ||
a = ss[x]; | ||
for(i = 0; i < a.length ; i++) { | ||
s = a[i]; | ||
if (!v) { | ||
v = true; | ||
if (debug) console.log('----------------------------------'); | ||
} | ||
if (debug) console.log('> '+ uix +' - sockets '+name+' - ' + i + ' - ' + !!s.destroyed + ' -- ' + !!s.busyWork + ' -- '+ String(new Date() - s._tmCreate).replace(/(\d{1,3})$/, '.$1') + ' > ' + x ); | ||
if ( (new Date() - s._tmCreate) > 1087000 ) { | ||
if (debug) console.log('<<< finish sockets - ' + name); | ||
s.destroy(); | ||
}; | ||
}; | ||
}; | ||
} | ||
function init_vflashFix(agent) { | ||
@@ -37,3 +75,6 @@ if (agent._init_vflashFix) return; | ||
while(s = sockets[--i]) { | ||
if (!s.busyWork && !s.destroyed) return s; | ||
if (!s.busyWork && !s.destroyed && (+new Date() - s._tmCreate) < 721000 ) { | ||
s._tmCreate = +new Date(); | ||
return s; | ||
}; | ||
}; | ||
@@ -52,3 +93,3 @@ }; | ||
if (!this.sockets[name]) this.sockets[name] = []; | ||
//console.log('-- addRequest - '+ (this.sockets[name].length) +' --'); | ||
//if (debug) console.log('-- addRequest - '+ (this.sockets[name].length) +' --'); | ||
@@ -73,3 +114,11 @@ var s; | ||
/* | ||
var tmcn = setTimeout(function() { | ||
if (debug) console.log('-- timmeout connect -- 12000 --- ' + name ) | ||
}, 12000) | ||
*/ | ||
s.on(s.getPeerCertificate ? 'secureConnect' : 'connect', function() { | ||
//clearTimeout(tmcn); | ||
s.busyWork = false; | ||
@@ -80,8 +129,11 @@ s.emit('free'); | ||
s.on('error', function x_error() { | ||
//clearTimeout(tmcn); | ||
s.busyWork = 'x-error'; | ||
if ( !(self.requests[name]||false).length || (self.sockets[name]||false).length ) { | ||
// console.log('-- error connect --'); | ||
// if (debug) console.log('-- error connect --'); | ||
return; | ||
}; | ||
console.log('-- !! error req connect !! --'); | ||
if (debug) console.log('-- !! error req connect !! --'); | ||
}); | ||
@@ -113,2 +165,4 @@ }; | ||
s._tmCreate = +new Date(); | ||
if (!self.sockets[name]) self.sockets[name] = []; | ||
@@ -127,3 +181,4 @@ this.sockets[name].push(s); | ||
if (self.requests[name] && self.requests[name].length) { | ||
//self.emit('free', s, host, port, localAddress); | ||
self.emit('free', s, host, port, localAddress); | ||
return; | ||
@@ -143,3 +198,3 @@ self.requests[name].shift().onSocket(s); | ||
s.destroy(); | ||
}, 7200); | ||
}, 1200); | ||
}; | ||
@@ -167,2 +222,3 @@ var onClose = function(err) { | ||
return s; | ||
}; | ||
}; | ||
@@ -5,3 +5,3 @@ { | ||
"keywords": ["http", "https"], | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"main" : "./http-xak.js", | ||
@@ -8,0 +8,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6982
163