Skip to content

Conversation

@willdonnelly
Copy link
Contributor

This commit fixes (*client.Conn).writeAuthHandshake() to use packet.NewConnWithTimeout instead of packet.NewBufferedConn when recreating the packet connection after switching TLS on. This preserves the connection read/write timeout settings which would otherwise be reset to zero.

Since this code executes after some reads and writes have already taken place, and the packet connection code only sets a deadline when the timeout values are nonzero, the result was that previously when connecting using TLS and with a read and/or write timeout set, the connection would inevitably fail just one timeout-duration after being opened.

This use of packet.NewBufferedConn appears to be the only place in the client package where a packet connection was recreated without the timeout configuration being plumbed through.

This commit fixes `(*client.Conn).writeAuthHandshake()` to use `packet.NewConnWithTimeout` instead of `packet.NewBufferedConn` when recreating the packet connection after switching TLS on. This preserves the connection read/write timeout settings which would otherwise be reset to zero. Since this code executes after some reads and writes have already taken place, and the packet connection code only sets a deadline when the timeout values are nonzero, the result was that previously when connecting using TLS and with a read and/or write timeout set, the connection would inevitably fail just one timeout-duration after being opened. This use of `packet.NewBufferedConn` appears to be the only place in the `client` package where a packet connection was recreated without the timeout configuration being plumbed through.
@lance6716 lance6716 merged commit ff1dab4 into go-mysql-org:master Oct 24, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants