Comparing version 0.0.1 to 1.0.0
38
http.js
@@ -112,17 +112,10 @@ 'use strict'; | ||
// Avoid duplicate timeout events by removing timeout listeners set | ||
// on socket by previous requests. node does not do this normally | ||
// because it assumes sockets are too short-lived for it to matter. | ||
// It becomes a problem when sockets are being reused. Fixed sometime | ||
// around Node 0.10.0. | ||
// | ||
// See https://github.com/joyent/node/commit/451ff1540 | ||
if (self.keepAliveTimeoutMsecs && | ||
socket._events && | ||
Array.isArray(socket._events.timeout)) { | ||
socket.removeAllListeners('timeout'); | ||
// Restore the socket's setTimeout() that was remove as collateral | ||
// damage. | ||
socket.setTimeout(self.keepAliveTimeoutMsecs, socket._reapTimeout); | ||
// set timeout on idle sockets | ||
if (options.keepAliveTimeoutMsecs !== undefined) { | ||
socket._yakaa_timeout = setTimeout(function () { | ||
self.emit('yakaa_destroy'); | ||
socket.destroySoon(); | ||
}, options.keepAliveTimeoutMsecs); | ||
} | ||
} | ||
@@ -187,2 +180,8 @@ } else { | ||
// mark socket as non-idle so it doesn't get destroyed mid-request | ||
if (socket._yakaa_timeout) { | ||
clearTimeout(socket._yakaa_timeout); | ||
delete socket._yakaa_timeout; | ||
} | ||
// don't leak | ||
@@ -240,11 +239,2 @@ if (!this.freeSockets[name].length) | ||
if (options.keepAliveTimeoutMsecs) { | ||
s._reapTimeout = function () { | ||
debug('_reapTimeout, socket destroy()'); | ||
s.destroy(); | ||
self.removeSocket(s, options); | ||
}; | ||
s.setTimeout(options.keepAliveTimeoutMsecs, s._reapTimeout); | ||
} | ||
function onFree() { | ||
@@ -283,2 +273,4 @@ self.emit('free', s, options); | ||
this.emit('yakaa_remove', s); | ||
// If the socket was destroyed, remove it from the free buffers too. | ||
@@ -285,0 +277,0 @@ if (s.destroyed) |
{ | ||
"name": "yakaa", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Yet Another Keep-Alive Agent", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "tap test" | ||
}, | ||
@@ -26,3 +26,6 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/newrelic/yakaa" | ||
"homepage": "https://github.com/newrelic/yakaa", | ||
"devDependencies": { | ||
"tap": "^0.4.8" | ||
} | ||
} |
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
Network access
Supply chain riskThis module accesses the network.
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
26139
13
492
0
0
154
1
4