fix: 兼容 MySQL 代理 packet out of order

Co-authored-by: zipg <4047349+zipg@users.noreply.github.com>
This commit is contained in:
zipg 2026-07-09 22:21:32 +08:00 committed by GitHub
parent ed9fe57617
commit 63ef26b25a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -1068,6 +1068,9 @@ fn mysql_error_should_retry_without_ssl(error: &str) -> bool {
|| error.contains("handshake")
|| error.contains("tls connection")
|| error.contains("server closed session")
// Some older MySQL proxies report a failed preferred-TLS probe as a
// protocol packet error instead of a TLS handshake error.
|| error.contains("packet out of order")
// Some MySQL-compatible servers report a preferred-TLS attempt as a
// normal server error instead of a TLS handshake error.
|| (error.contains("client asked for ssl") && error.contains("server does not have this capability"))
@ -4206,6 +4209,13 @@ UNIQUE KEY(`tenant_id`, `name``part`)
assert!(mysql_error_should_retry_without_ssl(error));
}
#[test]
fn mysql_packet_out_of_order_can_retry_without_ssl() {
let error = "MySQL connection failed: Input/output error: Input/output error: packet out of order";
assert!(mysql_error_should_retry_without_ssl(error));
}
#[test]
fn mysql_tcp_keepalive_uses_milliseconds_not_seconds() {
assert_eq!(MYSQL_TCP_KEEPALIVE_MS, 30_000);