From 7527d4ca2ce880b097b0d19b2ccaa466531e885d Mon Sep 17 00:00:00 2001 From: iaburton Date: Thu, 28 Mar 2019 13:04:50 -0500 Subject: [PATCH] Fix tls.Config copy that breaks synchronization with internal sync types. Closes #254 --- conn.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conn.go b/conn.go index c1b31859..c9740d18 100644 --- a/conn.go +++ b/conn.go @@ -385,9 +385,9 @@ func (c *Conn) identify() (*IdentifyResponse, error) { func (c *Conn) upgradeTLS(tlsConf *tls.Config) error { // create a local copy of the config to set ServerName for this connection - var conf tls.Config + conf := new(tls.Config) if tlsConf != nil { - conf = *tlsConf + conf = tlsConf.Clone() } host, _, err := net.SplitHostPort(c.addr) if err != nil { @@ -395,7 +395,7 @@ func (c *Conn) upgradeTLS(tlsConf *tls.Config) error { } conf.ServerName = host - c.tlsConn = tls.Client(c.conn, &conf) + c.tlsConn = tls.Client(c.conn, conf) err = c.tlsConn.Handshake() if err != nil { return err