From 7543ae5860bbd8a6511539f91a27eff6d7d18386 Mon Sep 17 00:00:00 2001 From: Brian Avery Date: Mon, 12 Oct 2020 13:43:10 -0400 Subject: [PATCH] MAISTRA-1166: Treat EAGAIN as SSL_ERROR_WANT_READ (#46) Co-authored-by: Kevin Conner (cherry picked from commit d4bd4cfa0dc513e7833fbe117ba0b3479ef86038) Signed-off-by: Brian Avery --- source/extensions/transport_sockets/tls/ssl_socket.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/extensions/transport_sockets/tls/ssl_socket.cc b/source/extensions/transport_sockets/tls/ssl_socket.cc index cd9f97767a47..50477bfb9408 100644 --- a/source/extensions/transport_sockets/tls/ssl_socket.cc +++ b/source/extensions/transport_sockets/tls/ssl_socket.cc @@ -152,10 +152,16 @@ Network::IoResult SslSocket::doRead(Buffer::Instance& read_buffer) { break; } FALLTHRU; + case SSL_ERROR_SSL: + // If EAGAIN treat it as if it's SSL_ERROR_WANT_READ + if (errno == EAGAIN) { + break; + } + // fall through for other errors case SSL_ERROR_WANT_WRITE: // Renegotiation has started. We don't handle renegotiation so just fall through. default: - drainErrorQueue(); + drainErrorQueue(true); action = PostIoAction::Close; break; }