From 78e558bbc17465d318acd499a9610e120a837860 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Wed, 29 Jun 2016 14:08:23 -0700 Subject: [PATCH] fix Info passes lock by value --- credentials/credentials.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/credentials/credentials.go b/credentials/credentials.go index 23fe63eabd43..537079026116 100644 --- a/credentials/credentials.go +++ b/credentials/credentials.go @@ -116,7 +116,7 @@ func (t TLSInfo) AuthType() string { // tlsCreds is the credentials required for authenticating a connection using TLS. type tlsCreds struct { // TLS configuration - config tls.Config + config *tls.Config } func (c tlsCreds) Info() ProtocolInfo { @@ -158,7 +158,7 @@ func (c *tlsCreds) ClientHandshake(addr string, rawConn net.Conn, timeout time.D } c.config.ServerName = addr[:colonPos] } - conn := tls.Client(rawConn, &c.config) + conn := tls.Client(rawConn, c.config) if timeout == 0 { err = conn.Handshake() } else { @@ -177,7 +177,7 @@ func (c *tlsCreds) ClientHandshake(addr string, rawConn net.Conn, timeout time.D } func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) { - conn := tls.Server(rawConn, &c.config) + conn := tls.Server(rawConn, c.config) if err := conn.Handshake(); err != nil { rawConn.Close() return nil, nil, err @@ -187,7 +187,7 @@ func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) // NewTLS uses c to construct a TransportCredentials based on TLS. func NewTLS(c *tls.Config) TransportCredentials { - tc := &tlsCreds{*c} + tc := &tlsCreds{c} tc.config.NextProtos = alpnProtoStr return tc }