Construct full RPC addr just once

This commit is contained in:
jholdstock 2020-06-30 11:20:44 +01:00 committed by David Hill
parent c5485a28ec
commit c05cdc0069

View File

@ -46,8 +46,8 @@ func setup(user, pass, addr string, cert []byte, n wsrpc.Notifier) *client {
var mu sync.Mutex
var c *wsrpc.Client
return &client{&mu, c, addr, tlsOpt, authOpt, n}
fullAddr := "wss://" + addr + "/ws"
return &client{&mu, c, fullAddr, tlsOpt, authOpt, n}
}
func (c *client) Close() {
@ -85,8 +85,7 @@ func (c *client) dial(ctx context.Context) (Caller, bool, error) {
}
var err error
fullAddr := "wss://" + c.addr + "/ws"
c.client, err = wsrpc.Dial(ctx, fullAddr, c.tlsOpt, c.authOpt, wsrpc.WithNotifier(c.notifier))
c.client, err = wsrpc.Dial(ctx, c.addr, c.tlsOpt, c.authOpt, wsrpc.WithNotifier(c.notifier))
if err != nil {
return nil, false, err
}