diff --git a/lib/tls.js b/lib/tls.js index e396b592e8..9f3a42b511 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -574,11 +574,10 @@ function onhandshakestart() { var self = this, ssl = this.ssl; if (ssl.timer === null) { - function timeout() { + ssl.timer = setTimeout(function timeout() { ssl.handshakes = 0; ssl.timer = null; - } - ssl.timer = setTimeout(timeout, exports.CLIENT_RENEG_WINDOW * 1000); + }, exports.CLIENT_RENEG_WINDOW * 1000); } else if (++ssl.handshakes > exports.CLIENT_RENEG_LIMIT) { // Defer the error event to the next tick. We're being called from OpenSSL's