This commit is contained in:
crusader 2017-12-01 22:14:47 +09:00
parent b0aa331648
commit c55c459f39

View File

@ -43,13 +43,13 @@ func (s *server) Start() error {
s.sh.Validate()
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
s.ctx = s.sh.ServerContext()
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 {
@ -66,7 +66,8 @@ func (s *server) Start() error {
func (s *server) Stop() {
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)
s.stopWg.Wait()