From 5ca08cf75f95f8f1e63267f6db7ca1a9367bf297 Mon Sep 17 00:00:00 2001 From: Masakazu Kitajo Date: Thu, 19 Sep 2024 09:12:31 -0600 Subject: [PATCH] Reduce the number of calls for ERR_clear_error (#11778) Since we check the error only after the loop, clearing error on each iteration does not make sense. --- src/iocore/net/SSLNetVConnection.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iocore/net/SSLNetVConnection.cc b/src/iocore/net/SSLNetVConnection.cc index d75c97b42ba..dcf222aea77 100644 --- a/src/iocore/net/SSLNetVConnection.cc +++ b/src/iocore/net/SSLNetVConnection.cc @@ -812,6 +812,7 @@ SSLNetVConnection::load_buffer_and_write(int64_t towrite, MIOBufferAccessor &buf Dbg(dbg_ctl_ssl, "towrite=%" PRId64, towrite); + ERR_clear_error(); do { // What is remaining left in the next block? l = buf.reader()->block_read_avail(); @@ -2491,7 +2492,6 @@ SSLNetVConnection::_ssl_write_buffer(const void *buf, int64_t nbytes, int64_t &n if (unlikely(nbytes == 0)) { return SSL_ERROR_NONE; } - ERR_clear_error(); int ret; // If SSL_write_early_data is available, it's probably OpenSSL,