don't modify DefaultConfig

This commit is contained in:
Yasuhiro Matsumoto 2017-04-23 19:07:54 +09:00
parent 16b6a7bdba
commit 906d9d747d

View File

@ -191,7 +191,9 @@ func (o Options) NewClient() (*Client, error) {
tlsconn = tls.Client(c, o.TLSConfig) tlsconn = tls.Client(c, o.TLSConfig)
} else { } else {
DefaultConfig.ServerName = host DefaultConfig.ServerName = host
tlsconn = tls.Client(c, &DefaultConfig) newconfig := DefaultConfig
newconfig.ServerName = host
tlsconn = tls.Client(c, &newconfig)
} }
if err = tlsconn.Handshake(); err != nil { if err = tlsconn.Handshake(); err != nil {
return nil, err return nil, err
@ -635,7 +637,7 @@ func (c *Client) SendPresence(presence Presence) (n int, err error) {
// SendKeepAlive sends a "whitespace keepalive" as described in chapter 4.6.1 of RFC6120. // SendKeepAlive sends a "whitespace keepalive" as described in chapter 4.6.1 of RFC6120.
func (c *Client) SendKeepAlive() (n int, err error) { func (c *Client) SendKeepAlive() (n int, err error) {
return fmt.Fprintf(c.conn," ") return fmt.Fprintf(c.conn, " ")
} }
// SendHtml sends the message as HTML as defined by XEP-0071 // SendHtml sends the message as HTML as defined by XEP-0071