Skip to content

Commit

Permalink
tls_wrap: invoke queued callbacks in DestroySSL
Browse files Browse the repository at this point in the history
PR-URL: #1702
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
  • Loading branch information
indutny committed Jun 4, 2015
1 parent 75930bb commit 59d9734
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/tls_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -770,7 +764,16 @@ void TLSWrap::EnableSessionCallbacks(

void TLSWrap::DestroySSL(const FunctionCallbackInfo<Value>& args) {
TLSWrap* wrap = Unwrap<TLSWrap>(args.Holder());

// Move all writes to pending
wrap->MakePending();

// And destroy
wrap->InvokeQueued(UV_ECANCELED);

// Destroy the SSL structure and friends
wrap->SSLWrap<TLSWrap>::DestroySSL();

delete wrap->clear_in_;
wrap->clear_in_ = nullptr;
}
Expand Down

0 comments on commit 59d9734

Please sign in to comment.