From: Fedor Indutny Date: Tue, 19 May 2015 11:18:42 +0000 (+0200) Subject: tls_wrap: invoke queued callbacks in DestroySSL X-Git-Tag: v2.3.0~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59d9734e216c79cdab762f0f7eb38f1df3b944a0;p=platform%2Fupstream%2Fnodejs.git tls_wrap: invoke queued callbacks in DestroySSL PR-URL: https://github.com/nodejs/io.js/pull/1702 Reviewed-By: Trevor Norris --- diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index ca0690d..b8a648d 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -86,12 +86,6 @@ TLSWrap::~TLSWrap() { sni_context_.Reset(); #endif // SSL_CTRL_SET_TLSEXT_SERVERNAME_CB - // Move all writes to pending - MakePending(); - - // And destroy - InvokeQueued(UV_ECANCELED); - ClearError(); } @@ -770,7 +764,16 @@ void TLSWrap::EnableSessionCallbacks( void TLSWrap::DestroySSL(const FunctionCallbackInfo& args) { TLSWrap* wrap = Unwrap(args.Holder()); + + // Move all writes to pending + wrap->MakePending(); + + // And destroy + wrap->InvokeQueued(UV_ECANCELED); + + // Destroy the SSL structure and friends wrap->SSLWrap::DestroySSL(); + delete wrap->clear_in_; wrap->clear_in_ = nullptr; }