mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-21 21:30:50 +01:00
Add mutex locking to SetTLSConfig
This change ensures that the SetTLSConfig method is thread-safe by adding a mutex lock. The lock is acquired before any changes to the TLS configuration and released afterward to prevent concurrent access issues.
This commit is contained in:
parent
2234f0c5bc
commit
f59aa23ed8
1 changed files with 3 additions and 0 deletions
|
@ -555,6 +555,9 @@ func (c *Client) SetLogger(logger log.Logger) {
|
|||
|
||||
// SetTLSConfig overrides the current *tls.Config with the given *tls.Config value
|
||||
func (c *Client) SetTLSConfig(tlsconfig *tls.Config) error {
|
||||
c.mutex.Lock()
|
||||
defer c.mutex.Unlock()
|
||||
|
||||
if tlsconfig == nil {
|
||||
return ErrInvalidTLSConfig
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue