2
0

fix logging

This commit is contained in:
Nikolay Pavlovich
2022-09-07 23:34:33 +03:00
parent 2fd5fa5bee
commit aef9c37b74
+4 -3
View File
@@ -325,11 +325,12 @@ func (rc *RecConn) SetTLSClientConfig(tlsClientConfig *tls.Config) {
// the origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies
// (Cookie). Use GetHTTPResponse() method for the response.Header to get
// the selected subprotocol (Sec-WebSocket-Protocol) and cookies (Set-Cookie).
func (rc *RecConn) Dial(urlStr string, reqHeader http.Header) {
func (rc *RecConn) Dial(urlStr string, reqHeader http.Header) error {
urlStr, err := rc.parseURL(urlStr)
if err != nil {
rc.log(LogValues{Msg: "Dial", Err: err, Fatal: true})
return err
}
// Config
@@ -347,6 +348,7 @@ func (rc *RecConn) Dial(urlStr string, reqHeader http.Header) {
// wait on first attempt
time.Sleep(rc.getHandshakeTimeout())
return nil
}
// GetURL returns current connection url
@@ -471,8 +473,7 @@ func (rc *RecConn) connect() {
if rc.hasSubscribeHandler() {
if err := rc.SubscribeHandler(); err != nil {
rc.log(LogValues{Msg: "Dial: connect handler failed", Err: err, Fatal: true})
}
if !rc.getNonVerbose() {
} else if !rc.getNonVerbose() {
rc.log(LogValues{Msg: "Dial: connect handler was successfully established", Url: rc.url})
}
}