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
1 changed files with 8 additions and 2 deletions

10
http.go
View File

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