From 9d3cb65daaf630acb1c87b8f45d13b8def7d7a22 Mon Sep 17 00:00:00 2001 From: Asim Aslam <asim@chuhnk.me> Date: Sat, 18 Aug 2018 17:28:58 +0100 Subject: [PATCH] set broker address on Init --- broker/http_broker.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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() }