diff --git a/broker/http_broker.go b/broker/http_broker.go index c5dc13ff..48a110c6 100644 --- a/broker/http_broker.go +++ b/broker/http_broker.go @@ -276,7 +276,6 @@ func (h *httpBroker) Address() string { } func (h *httpBroker) Connect() error { - h.RLock() if h.running { h.RUnlock() @@ -397,6 +396,10 @@ func (h *httpBroker) Init(opts ...Option) error { o(&h.opts) } + if len(h.opts.Addrs) > 0 && len(h.opts.Addrs[0]) > 0 { + h.address = h.opts.Addrs[0] + } + if len(h.id) == 0 { h.id = "broker-" + uuid.NewUUID().String() }