This commit is contained in:
crusader 2017-11-30 16:09:09 +09:00
parent 888569749a
commit 3e3a884c4d

View File

@ -85,14 +85,13 @@ func (s *rpcServlet) Stop() {
panic("Server: server must be started before stopping it")
}
s.sh.Destroy(s.ctx)
close(s.stopChan)
s.stopWg.Wait()
s.sh.Destroy(s.ctx)
s.stopChan = nil
s.responseQueueChan = nil
s.conn = nil
s.serverCodec = nil
@ -123,9 +122,9 @@ func handleServlet(s *rpcServlet) {
logging.Logger().Info(fmt.Sprintf("Servlet is started"))
defer func() {
s.doneChan <- err
s.stopWg.Done()
s.Stop()
s.doneChan <- err
}()
subStopChan := make(chan struct{})