This commit is contained in:
crusader 2018-03-23 01:48:16 +09:00
parent 5957c701f9
commit 6e59e6b669

View File

@ -39,6 +39,8 @@ type rpcServlet struct {
stopChan chan struct{} stopChan chan struct{}
stopWg sync.WaitGroup stopWg sync.WaitGroup
sendMtx sync.RWMutex
} }
func (s *rpcServlet) Context() ServletContext { func (s *rpcServlet) Context() ServletContext {
@ -83,6 +85,7 @@ func (s *rpcServlet) Start(parentCTX cuc.Context, conn interface{}, doneChan cha
} }
func (s *rpcServlet) Send(method string, args ...interface{}) (err error) { func (s *rpcServlet) Send(method string, args ...interface{}) (err error) {
s.sendMtx.RLock()
noti := &notification{ noti := &notification{
method: method, method: method,
args: args, args: args,
@ -92,7 +95,7 @@ func (s *rpcServlet) Send(method string, args ...interface{}) (err error) {
} }
s.responseQueueChan <- rs s.responseQueueChan <- rs
s.sendMtx.RUnlock()
return nil return nil
} }