From 21b4085bcc63027464fe045edd10ad779c1c9f9c Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 19 Apr 2018 22:51:36 +0900 Subject: [PATCH] ing --- servlet/rpc-servlet.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/servlet/rpc-servlet.go b/servlet/rpc-servlet.go index 57e2cc2..b907432 100644 --- a/servlet/rpc-servlet.go +++ b/servlet/rpc-servlet.go @@ -50,6 +50,7 @@ func (s *RPCServlets) Handle(servletCtx server.ServletCtx, err error ) sc := crpj.NewServerCodec() + go s.handleRPCWrite(stopChan, writeChan) for { select { @@ -73,6 +74,15 @@ func (s *RPCServlets) Handle(servletCtx server.ServletCtx, } writeChan <- replyBuff + case <-stopChan: + return + } + } +} + +func (s *RPCServlets) handleRPCWrite(stopChan <-chan struct{}, writeChan chan<- []byte) { + for { + select { case buf, ok := <-s.RPCWriteChan: if !ok { break