Skip to content

Commit c7276ee

Browse files
authored
Check mysqlConnector.canceled.Value when failed to TLS handshake (#1615)
### Description Check if the context is canceled when failed to TLS handshake. fix: #1614 ### Checklist - [x] Code compiles correctly - [x] Created tests which fail without the change (if possible) - [x] All tests passing - [x] Extended the README / documentation, if necessary - [x] Added myself / the copyright holder to the AUTHORS file <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added Nao Yokotsuka to the contributors list for improved project documentation. - **Bug Fixes** - Enhanced error handling in the TLS handshake process to better manage cancellation requests, improving connection responsiveness. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 44553d6 commit c7276ee

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Lunny Xiao <xiaolunwen at gmail.com>
8181
Luke Scott <luke at webconnex.com>
8282
Maciej Zimnoch <maciej.zimnoch at codilime.com>
8383
Michael Woolnough <michael.woolnough at gmail.com>
84+
Nao Yokotsuka <yokotukanao at gmail.com>
8485
Nathanial Murphy <nathanial.murphy at gmail.com>
8586
Nicola Peduzzi <thenikso at gmail.com>
8687
Oliver Bone <owbone at github.com>

Diff for: packets.go

+3
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
352352
// Switch to TLS
353353
tlsConn := tls.Client(mc.netConn, mc.cfg.TLS)
354354
if err := tlsConn.Handshake(); err != nil {
355+
if cerr := mc.canceled.Value(); cerr != nil {
356+
return cerr
357+
}
355358
return err
356359
}
357360
mc.netConn = tlsConn

0 commit comments

Comments
 (0)