mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-15 02:12:55 +01:00
Fix deferred mutex unlock in TLSConnectionState
Correct the sequence of mutex unlocking in TLSConnectionState to ensure the mutex is always released properly. This prevents potential deadlocks and ensures the function behaves as expected in a concurrent context.
This commit is contained in:
parent
2d98c40cb6
commit
8791ce5a33
1 changed files with 1 additions and 1 deletions
|
@ -209,13 +209,13 @@ func (c *Client) StartTLS(config *tls.Config) error {
|
|||
// not succeed.
|
||||
func (c *Client) TLSConnectionState() (state tls.ConnectionState, ok bool) {
|
||||
c.mutex.RLock()
|
||||
defer c.mutex.RUnlock()
|
||||
|
||||
tc, ok := c.conn.(*tls.Conn)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
state, ok = tc.ConnectionState(), true
|
||||
c.mutex.RUnlock()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue