diff options
author | Eugene Girshov <eugene.girshov@nixu.com> | 2013-03-04 22:44:56 +0200 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-03-06 10:45:37 -0800 |
commit | 25ba971f41d4ddaf7e241645cfc2917bd3afa1f7 (patch) | |
tree | fef60a5a8088098f26e38c7c13a66de27bd841cf /lib/http.js | |
parent | fb3ec32b0ea5e42f6a9a8f0d5f43779f92cfac4a (diff) | |
download | android-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.js | 7 |
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); }); }; |