This commit is contained in:
crusader 2017-11-30 15:43:19 +09:00
parent 3ed8b99ddd
commit cc4927b692

View File

@ -120,6 +120,8 @@ func (s *rpcServlet) Context() ServletContext {
func handleServlet(s *rpcServlet) {
var err error
logging.Logger().Info(fmt.Sprintf("Servlet is started"))
defer func() {
s.doneChan <- err
s.stopWg.Done()
@ -152,8 +154,12 @@ func handleServlet(s *rpcServlet) {
}
func handleReader(s *rpcServlet, stopChan chan struct{}, doneChan chan error) {
logging.Logger().Debug(fmt.Sprintf("reader of Servlet is started"))
var err error
defer func() {
logging.Logger().Debug(fmt.Sprintf("reader of Servlet is stopped"))
if r := recover(); r != nil {
if err == nil {
err = fmt.Errorf("RPC Server: Panic when reading request from client: %v", r)
@ -191,8 +197,11 @@ func handleReader(s *rpcServlet, stopChan chan struct{}, doneChan chan error) {
}
func handleWriter(s *rpcServlet, stopChan chan struct{}, doneChan chan error) {
logging.Logger().Debug(fmt.Sprintf("writer of Servlet is started"))
var err error
defer func() {
logging.Logger().Debug(fmt.Sprintf("writer of Servlet is stopped"))
if r := recover(); r != nil {
if err == nil {
err = fmt.Errorf("RPC Server: Panic when writing response to client: %v", r)