Skip to content

Commit

Permalink
Fix tls.Config copy that breaks synchronization with internal sync ty…
Browse files Browse the repository at this point in the history
…pes. Closes nsqio#254
  • Loading branch information
iaburton committed Mar 28, 2019
1 parent 61f49c0 commit 7527d4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,17 +385,17 @@ 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 {
return err
}
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
Expand Down

0 comments on commit 7527d4c

Please sign in to comment.