This commit is contained in:
crusader 2018-03-22 18:11:45 +09:00
parent ba6b26fe8b
commit 5f0dc6a76e

View File

@ -68,12 +68,13 @@ func (sh *RPCGatewayServletHandlers) OnConnect(soc cwf.Socket) {
func (sh *RPCGatewayServletHandlers) Handle(soc cwf.Socket, stopChan <-chan struct{}, doneChan chan<- error) {
var err error
// rpcServlet := retainRPCServlet(sh.gwRPCSH, sh.rpcRWCSH)
rpcServlet := retainRPCServlet(sh.gwRPCSH, sh.rpcRWCSH)
rpcServlet := cRPC.NewServlet(sh.gwRPCSH, sh.rpcRWCSH)
// rpcServlet := cRPC.NewServlet(sh.gwRPCSH, sh.rpcRWCSH)
defer func() {
// releaseRPCServlet(rpcServlet)
rpcServlet.Stop()
releaseRPCServlet(rpcServlet)
doneChan <- err
}()
@ -86,8 +87,6 @@ func (sh *RPCGatewayServletHandlers) Handle(soc cwf.Socket, stopChan <-chan stru
select {
case err = <-rpcDoneChan:
case <-stopChan:
rpcServlet.Stop()
<-rpcDoneChan
}
}
@ -122,6 +121,5 @@ func retainRPCServlet(sh GatewayRPCServletHandler, rpcRWCSH cRPC.ServletReadWrit
}
func releaseRPCServlet(s cRPC.Servlet) {
rpcServletPool.Put(s)
}