From f59aa23ed8658c9758cd3fe17165cd1fa18e0aed Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Fri, 27 Sep 2024 11:58:08 +0200 Subject: [PATCH] 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. --- client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.go b/client.go index 81ff065..48548ce 100644 --- a/client.go +++ b/client.go @@ -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 }