summaryrefslogtreecommitdiff
path: root/lib/http.js
diff options
context:
space:
mode:
authorEugene Girshov <eugene.girshov@nixu.com>2013-03-04 22:44:56 +0200
committerisaacs <i@izs.me>2013-03-06 10:45:37 -0800
commit25ba971f41d4ddaf7e241645cfc2917bd3afa1f7 (patch)
treefef60a5a8088098f26e38c7c13a66de27bd841cf /lib/http.js
parentfb3ec32b0ea5e42f6a9a8f0d5f43779f92cfac4a (diff)
downloadandroid-node-v8-25ba971f41d4ddaf7e241645cfc2917bd3afa1f7.tar.gz
android-node-v8-25ba971f41d4ddaf7e241645cfc2917bd3afa1f7.tar.bz2
android-node-v8-25ba971f41d4ddaf7e241645cfc2917bd3afa1f7.zip
http: fix multiple timeout events
Fixed up slightly by @isaacs so as not to miss 'timeout' events in some cases.
Diffstat (limited to 'lib/http.js')
-rw-r--r--lib/http.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/http.js b/lib/http.js
index e057e6baca..50571bf313 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, emitTimeout);
+ sock.setTimeout(msecs, emitTimeout);
});
return;
}
this.once('socket', function(sock) {
- this.setTimeout(msecs, emitTimeout);
+ sock.setTimeout(msecs, emitTimeout);
});
};