From 6e59e6b669f15f5c782308b742ce3e3c99ea2b16 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 23 Mar 2018 01:48:16 +0900 Subject: [PATCH] ing --- servlet.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/servlet.go b/servlet.go index 7317842..2574b8c 100644 --- a/servlet.go +++ b/servlet.go @@ -39,6 +39,8 @@ type rpcServlet struct { stopChan chan struct{} stopWg sync.WaitGroup + + sendMtx sync.RWMutex } 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) { + s.sendMtx.RLock() noti := ¬ification{ method: method, args: args, @@ -92,7 +95,7 @@ func (s *rpcServlet) Send(method string, args ...interface{}) (err error) { } s.responseQueueChan <- rs - + s.sendMtx.RUnlock() return nil }