From 99dad28ebf321a005815f6effd386f8a0c6cd766 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 21 Mar 2019 16:45:44 +0100 Subject: [PATCH] tls: add CHECK for impossible condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport-PR-URL: https://github.com/nodejs/node/pull/27967 PR-URL: https://github.com/nodejs/node/pull/26843 Reviewed-By: Sam Roberts Reviewed-By: Colin Ihrig Reviewed-By: Minwoo Jung Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Ruben Bridgewater --- src/tls_wrap.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 7dcf9d5f8a063e..6e827d3dc2e047 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -680,10 +680,10 @@ void TLSWrap::OnStreamRead(ssize_t nread, const uv_buf_t& buf) { return; } - if (ssl_ == nullptr) { - EmitRead(UV_EPROTO); - return; - } + // DestroySSL() is the only thing that un-sets ssl_, but that also removes + // this TLSWrap as a stream listener, so we should not receive OnStreamRead() + // calls anymore. + CHECK(ssl_); // Commit the amount of data actually read into the peeked/allocated buffer // from the underlying stream.