From 4c402f8e76b2be6908515b9e8231cc9af6ebeb00 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 6 Oct 2014 16:23:01 +0400 Subject: [PATCH] tls_wrap: ignore ZERO_RETURN after close_notify Do not call SSL_read() and ignore ZERO_RETURN if the connection was shutdown and there could not be any reads. --- src/tls_wrap.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 84bc87e0cc43..ac05c8ecaceb 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -447,6 +447,10 @@ void TLSCallbacks::ClearOut() { if (!hello_parser_.IsEnded()) return; + // No reads after EOF + if (eof_) + return; + HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); @@ -476,6 +480,10 @@ void TLSCallbacks::ClearOut() { int err; Local arg = GetSSLError(read, &err, NULL); + // Ignore ZERO_RETURN after EOF, it is basically not a error + if (err == SSL_ERROR_ZERO_RETURN && eof_) + return; + if (!arg.IsEmpty()) { // When TLS Alert are stored in wbio, // it should be flushed to socket before destroyed.