fix: Broker's port is not registered.

Connecting to broker before registering.
This commit is contained in:
xinfei.wu 2019-02-27 12:28:03 +08:00 committed by Vasiliy Tolstov
parent b8a7b08984
commit f07f7ac0d6

10
http.go
View File

@ -247,8 +247,14 @@ func (h *httpServer) Start() error {
return errors.New("Server required http.Handler") return errors.New("Server required http.Handler")
} }
if err = opts.Broker.Connect(); err != nil {
return err
}
// register // register
h.Register() if err = h.Register(); err != nil {
return err
}
go http.Serve(ln, handler) go http.Serve(ln, handler)
@ -286,7 +292,7 @@ func (h *httpServer) Start() error {
opts.Broker.Disconnect() opts.Broker.Disconnect()
}() }()
return opts.Broker.Connect() return nil
} }
func (h *httpServer) Stop() error { func (h *httpServer) Stop() error {