This commit is contained in:
crusader 2018-04-19 22:46:49 +09:00
parent f76a10dcd1
commit 2efb6bf2ce
2 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package service package service
import ( import (
"fmt"
"reflect" "reflect"
cda "git.loafle.net/commons/di-go/annotation" cda "git.loafle.net/commons/di-go/annotation"
@ -47,7 +48,11 @@ func (s *ProbeService) Send(method string, params ...interface{}) error {
return err return err
} }
s.RPCWriteChan <- buf select {
case s.RPCWriteChan <- buf:
default:
return fmt.Errorf("cannot write to rpcWriteChan")
}
return nil return nil
} }

View File

@ -3,7 +3,7 @@ package servlet
import ( import (
"net" "net"
logging "git.loafle.net/commons/logging-go" "git.loafle.net/commons/logging-go"
crp "git.loafle.net/commons/rpc-go/protocol" crp "git.loafle.net/commons/rpc-go/protocol"
crpj "git.loafle.net/commons/rpc-go/protocol/json" crpj "git.loafle.net/commons/rpc-go/protocol/json"
crr "git.loafle.net/commons/rpc-go/registry" crr "git.loafle.net/commons/rpc-go/registry"
@ -73,7 +73,11 @@ func (s *RPCServlets) Handle(servletCtx server.ServletCtx,
} }
writeChan <- replyBuff writeChan <- replyBuff
case buf := <-s.RPCWriteChan: case buf, ok := <-s.RPCWriteChan:
if !ok {
break
}
writeChan <- buf writeChan <- buf
case <-stopChan: case <-stopChan:
return return