Skip to content

Commit a9e9b9a

Browse files
committed
tls_wrap: invoke queued callbacks in DestroySSL
1 parent 79c1ba1 commit a9e9b9a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/tls_wrap.cc

+9-6
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@ TLSWrap::~TLSWrap() {
8686
sni_context_.Reset();
8787
#endif // SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
8888

89-
// Move all writes to pending
90-
MakePending();
91-
92-
// And destroy
93-
InvokeQueued(UV_ECANCELED);
94-
9589
ClearError();
9690
}
9791

@@ -763,7 +757,16 @@ void TLSWrap::EnableSessionCallbacks(
763757

764758
void TLSWrap::DestroySSL(const FunctionCallbackInfo<Value>& args) {
765759
TLSWrap* wrap = Unwrap<TLSWrap>(args.Holder());
760+
761+
// Move all writes to pending
762+
wrap->MakePending();
763+
764+
// And destroy
765+
wrap->InvokeQueued(UV_ECANCELED);
766+
767+
// Destroy the SSL structure and friends
766768
wrap->SSLWrap<TLSWrap>::DestroySSL();
769+
767770
delete wrap->clear_in_;
768771
wrap->clear_in_ = nullptr;
769772
}

0 commit comments

Comments
 (0)