Skip to content

Commit 7527d4c

Browse files
committedMar 28, 2019
Fix tls.Config copy that breaks synchronization with internal sync types. Closes nsqio#254
1 parent 61f49c0 commit 7527d4c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎conn.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,17 @@ func (c *Conn) identify() (*IdentifyResponse, error) {
385385

386386
func (c *Conn) upgradeTLS(tlsConf *tls.Config) error {
387387
// create a local copy of the config to set ServerName for this connection
388-
var conf tls.Config
388+
conf := new(tls.Config)
389389
if tlsConf != nil {
390-
conf = *tlsConf
390+
conf = tlsConf.Clone()
391391
}
392392
host, _, err := net.SplitHostPort(c.addr)
393393
if err != nil {
394394
return err
395395
}
396396
conf.ServerName = host
397397

398-
c.tlsConn = tls.Client(c.conn, &conf)
398+
c.tlsConn = tls.Client(c.conn, conf)
399399
err = c.tlsConn.Handshake()
400400
if err != nil {
401401
return err

0 commit comments

Comments
 (0)