From 4cfdc57712ef4657157fbb0c14481bb05f91577f Mon Sep 17 00:00:00 2001 From: Jonas Westerlund Date: Wed, 4 Jul 2012 23:17:14 +0200 Subject: [PATCH] Inline timeout function, avoiding declaration in conditional Moving it out would require an anonymous function, or bind(), anyway. Luckily It's a tiny function. Fixes crash in strict mode. --- lib/tls.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/tls.js b/lib/tls.js index e396b592e80..9f3a42b5117 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