Comparing version 2.2.7 to 2.2.8
@@ -290,2 +290,3 @@ /* | ||
conn = connh; | ||
socket.once('free', onFree); | ||
@@ -301,2 +302,27 @@ socket.once('close', onClose); | ||
req.removeListener('abort', onAbort); | ||
/* | ||
* The node http framework (especially in 0.10.x) can leave | ||
* handlers on socket events when the socket has closed and the | ||
* request completed normally (e.g. the remote server doesn't | ||
* support keep-alive, or we exceeded its maximum time). | ||
* | ||
* To avoid a spurious warning here, we disable the handler | ||
* leak check. | ||
*/ | ||
conn.disableReleaseLeakCheck(); | ||
/* | ||
* Unfortunately, there is no way to distinguish between a | ||
* 'close' event coming out of a socket where the request | ||
* succeeded, and one coming out of a socket where it closed | ||
* prematurely and the HTTP-level request failed. Node does not | ||
* actually have any way to tell the difference between these | ||
* (and actually doesn't know whether a request "ended early" | ||
* at all, since it doesn't keep track of Content-Length | ||
* properly, especially in 0.10.x). | ||
* | ||
* As a result, if we get a 'close' event before any other | ||
* event happens, we give it the benefit of the doubt and | ||
* don't induce a cueball-level backoff. We do this by always | ||
* calling .release() instead of .close() on the handle here. | ||
*/ | ||
conn.release(); | ||
@@ -329,9 +355,13 @@ conn = undefined; | ||
} | ||
/* | ||
* Called when the http framework wants to notify us that the request | ||
* did an Upgrade or similar, and the socket is now being used for | ||
* other purposes (and won't be available for more HTTP requests). | ||
* | ||
* We keep the lease open until 'close' is emitted, and take off all | ||
* our other handlers. | ||
*/ | ||
function onAgentRemove() { | ||
sock.removeListener('close', onClose); | ||
sock.removeListener('free', onFree); | ||
req.removeListener('abort', onAbort); | ||
conn.close(); | ||
conn = undefined; | ||
sock = undefined; | ||
} | ||
@@ -338,0 +368,0 @@ }; |
@@ -501,2 +501,3 @@ /* | ||
this.ch_lastError = undefined; | ||
this.ch_doReleaseLeakCheck = true; | ||
@@ -519,2 +520,6 @@ FSM.call(this, 'waiting'); | ||
CueBallClaimHandle.prototype.disableReleaseLeakCheck = function () { | ||
this.ch_doReleaseLeakCheck = false; | ||
}; | ||
CueBallClaimHandle.prototype.on = function (evt) { | ||
@@ -691,2 +696,5 @@ if (evt === 'readable' || evt === 'close') { | ||
if (!this.ch_doReleaseLeakCheck) | ||
return; | ||
var conn = this.ch_connection; | ||
@@ -693,0 +701,0 @@ var self = this; |
{ | ||
"name": "cueball", | ||
"version": "2.2.7", | ||
"version": "2.2.8", | ||
"description": "manage a pool of connections to a multi-node service where nodes are listed in DNS", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
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
174943
4752