Skip to content

Commit aabecff

Browse files
committed
Bug#33302441 mock-server warns about tls::zero_return
Problem ======= When closing a connection to the mysql_server_mock its error-log contains: tls::zero_return which is return by openssl on connection-close. Change ====== - map tls::zero_return to net::stream_errc::eof which does the same and is properly suppressed. RB: 26936
1 parent 15b22ae commit aabecff

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

router/src/mock_server/src/statement_reader.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ class ProtocolBase {
171171
}
172172
}
173173

174+
// TlsErrc to net::stream_errc if needed.
175+
static std::error_code map_tls_error_code(std::error_code ec) {
176+
return (ec == TlsErrc::kZeroReturn) ? net::stream_errc::eof : ec;
177+
}
178+
174179
template <class CompletionToken>
175180
void async_receive_tls(CompletionToken &&token) {
176181
net::async_completion<CompletionToken, void(std::error_code, size_t)> init{
@@ -208,9 +213,11 @@ class ProtocolBase {
208213
} else {
209214
// as we can't handle the error, forward the error to the
210215
// completion handler
211-
net::defer(client_socket_.get_executor(),
212-
[compl_handler = std::move(init.completion_handler),
213-
ec = read_ec]() { compl_handler(ec, {}); });
216+
217+
net::defer(
218+
client_socket_.get_executor(),
219+
[compl_handler = std::move(init.completion_handler),
220+
ec = map_tls_error_code(read_ec)]() { compl_handler(ec, {}); });
214221
}
215222
} else {
216223
// success, forward it to the completion handler

0 commit comments

Comments
 (0)