Skip to content

Commit

Permalink
tls_wrap: invoke queued callbacks in DestroySSL
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed May 19, 2015
1 parent 79c1ba1 commit a9e9b9a
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 @@ -763,7 +757,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 a9e9b9a

Please sign in to comment.