Skip to content

Instantly share code, notes, and snippets.

@isaacs isaacs/pooch.diff
Last active Dec 14, 2015

Embed
What would you like to do?
commit af11cb5b58188faa994752260ba4679681a50f95
Author: isaacs <i@izs.me>
Date: Wed Mar 6 10:22:06 2013 -0800
fixup for #4920
diff --git a/lib/http.js b/lib/http.js
index 19f2cd0..50571bf 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -1721,15 +1721,18 @@ ClientRequest.prototype.setTimeout = function(msecs, callback) {
return;
}
+ // Set timeoutCb so that it'll get cleaned up on request end
+ this.timeoutCb = emitTimeout;
if (this.socket) {
+ var sock = this.socket;
this.socket.once('connect', function() {
- this.setTimeout(msecs);
+ sock.setTimeout(msecs, emitTimeout);
});
return;
}
this.once('socket', function(sock) {
- this.setTimeout(msecs);
+ sock.setTimeout(msecs, emitTimeout);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.