diff --git a/lib/tls.js b/lib/tls.js index 55acac7ff2..0edd9d200f 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -702,7 +702,7 @@ function onhandshakestart() { // Defer the error event to the next tick. We're being called from OpenSSL's // state machine and OpenSSL is not re-entrant. We cannot allow the user's // callback to destroy the connection right now, it would crash and burn. - process.nextTick(function() { + setImmediate(function() { var err = new Error('TLS session renegotiation attack detected.'); if (self.cleartext) self.cleartext.emit('error', err); });