diff --git a/lib/_tls_legacy.js b/lib/_tls_legacy.js index 8c079e341b..36b4f8bb16 100644 --- a/lib/_tls_legacy.js +++ b/lib/_tls_legacy.js @@ -614,13 +614,15 @@ function onclienthello(hello) { if (err) return self.socket.destroy(err); - self.ssl.loadSession(session); - self.ssl.endParser(); + setImmediate(function() { + self.ssl.loadSession(session); + self.ssl.endParser(); - // Cycle data - self._resumingSession = false; - self.cleartext.read(0); - self.encrypted.read(0); + // Cycle data + self._resumingSession = false; + self.cleartext.read(0); + self.encrypted.read(0); + }); } if (hello.sessionId.length <= 0 ||