Fix error result from Transport.Connect errors
This commit is contained in:
parent
8fb3e33a1f
commit
01d78a1e5c
|
@ -23,11 +23,12 @@ func (t *WebsocketTransport) Connect() error {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
wsConn, _, err := websocket.Dial(ctx, t.Config.Address, nil)
|
wsConn, _, err := websocket.Dial(ctx, t.Config.Address, nil)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
t.wsConn = wsConn
|
return NewConnError(err, true)
|
||||||
t.netConn = websocket.NetConn(t.ctx, t.wsConn, websocket.MessageText)
|
|
||||||
}
|
}
|
||||||
return err
|
t.wsConn = wsConn
|
||||||
|
t.netConn = websocket.NetConn(t.ctx, t.wsConn, websocket.MessageText)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t WebsocketTransport) StartTLS(domain string) error {
|
func (t WebsocketTransport) StartTLS(domain string) error {
|
||||||
|
|
|
@ -19,7 +19,10 @@ func (t *XMPPTransport) Connect() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
t.conn, err = net.DialTimeout("tcp", t.Config.Address, time.Duration(t.Config.ConnectTimeout)*time.Second)
|
t.conn, err = net.DialTimeout("tcp", t.Config.Address, time.Duration(t.Config.ConnectTimeout)*time.Second)
|
||||||
return err
|
if err != nil {
|
||||||
|
return NewConnError(err, true)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t XMPPTransport) DoesStartTLS() bool {
|
func (t XMPPTransport) DoesStartTLS() bool {
|
||||||
|
|
Loading…
Reference in a new issue