ing
This commit is contained in:
parent
b0aa331648
commit
c55c459f39
|
@ -43,13 +43,13 @@ func (s *server) Start() error {
|
||||||
s.sh.Validate()
|
s.sh.Validate()
|
||||||
|
|
||||||
if s.stopChan != nil {
|
if s.stopChan != nil {
|
||||||
panic("Server: server is already running. Stop it before starting it again")
|
return fmt.Errorf("Server: server is already running. Stop it before starting it again")
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
s.ctx = s.sh.ServerContext()
|
s.ctx = s.sh.ServerContext()
|
||||||
|
|
||||||
if err = s.sh.Init(s.ctx); nil != err {
|
if err = s.sh.Init(s.ctx); nil != err {
|
||||||
logging.Logger().Panic(fmt.Sprintf("Server: Initialization of server has been failed %v", err))
|
return fmt.Errorf("Server: Initialization of server has been failed %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.listener, err = s.sh.Listen(s.ctx); nil != err {
|
if s.listener, err = s.sh.Listen(s.ctx); nil != err {
|
||||||
|
@ -66,7 +66,8 @@ func (s *server) Start() error {
|
||||||
|
|
||||||
func (s *server) Stop() {
|
func (s *server) Stop() {
|
||||||
if s.stopChan == nil {
|
if s.stopChan == nil {
|
||||||
panic("Server: server must be started before stopping it")
|
logging.Logger().Warn("Server: server must be started before stopping it")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
close(s.stopChan)
|
close(s.stopChan)
|
||||||
s.stopWg.Wait()
|
s.stopWg.Wait()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user