Fix "Established connection" log message.

Don't log "Established connection" message on new when
DisableConnectOnNew is set and no connection was actually established.
Do log that same message when Connect() successfully connects.
This commit is contained in:
Rune T. Aune 2015-11-21 14:28:18 -06:00
parent 975536f20f
commit b81555beea

View file

@ -1211,8 +1211,6 @@ func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error
start = true
}
}
log.Infof("Established connection to RPC server %s",
config.Host)
client := &Client{
config: config,
@ -1230,6 +1228,8 @@ func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error
}
if start {
log.Infof("Established connection to RPC server %s",
config.Host)
close(connEstablished)
client.start()
if !client.config.HTTPPostMode && !client.config.DisableAutoReconnect {
@ -1282,6 +1282,8 @@ func (c *Client) Connect(tries int) error {
// Connection was established. Set the websocket connection
// member of the client and start the goroutines necessary
// to run the client.
log.Infof("Established connection to RPC server %s",
c.config.Host)
c.wsConn = wsConn
close(c.connEstablished)
c.start()