This commit is contained in:
crusader 2018-04-10 12:53:46 +09:00
parent 28a86a9282
commit 63fa257178

View File

@ -60,9 +60,9 @@ func (s *RPCServlets) Handle(servletCtx server.ServletCtx,
if nil != _clientType && nil != _sessionID && nil != _targetID { if nil != _clientType && nil != _sessionID && nil != _targetID {
md = metadata.Pairs( md = metadata.Pairs(
og.GRPCClientTypeKey, _clientType.(og.ClientType).String(), og.GRPCClientTypeKey.String(), _clientType.(og.ClientType).String(),
og.GRPCSessionIDKey, _sessionID.(string), og.GRPCSessionIDKey.String(), _sessionID.(string),
og.GRPCTargetIDKey, _targetID.(string), og.GRPCTargetIDKey.String(), _targetID.(string),
) )
} }
@ -77,15 +77,15 @@ func (s *RPCServlets) Handle(servletCtx server.ServletCtx,
// grpc exec method call // grpc exec method call
src, err = sc.NewRequest(msg) src, err = sc.NewRequest(msg)
if nil != err { if nil != err {
logging.Logger().Errore(err) logging.Logger().Error(err)
break break
} }
method = src.Method() method = src.Method()
params, err = src.Params() params, err = src.Params()
if nil != err { if nil != err {
logging.Logger().Errore(err) logging.Logger().Error(err)
s.writeError(crp.E_BAD_PARAMS, "", err) s.writeError(src, writeChan, crp.E_BAD_PARAMS, "", err)
break break
} }
@ -93,8 +93,8 @@ func (s *RPCServlets) Handle(servletCtx server.ServletCtx,
grpcReply, err = ogeg.Exec(grpcCtx, method, params...) grpcReply, err = ogeg.Exec(grpcCtx, method, params...)
replyBuff, err = src.NewResponseWithString(grpcReply, err) replyBuff, err = src.NewResponseWithString(grpcReply, err)
if nil != err { if nil != err {
logging.Logger().Errore(err) logging.Logger().Error(err)
s.writeError(crp.E_INTERNAL, "", err) s.writeError(src, writeChan, crp.E_INTERNAL, "", err)
break break
} }
@ -107,7 +107,7 @@ func (s *RPCServlets) Handle(servletCtx server.ServletCtx,
} }
func (s *RPCServlets) writeError(src crp.ServerRequestCodec, writeChan chan<- []byte, code int, message string, data interface{}) { func (s *RPCServlets) writeError(src crp.ServerRequestCodec, writeChan chan<- []byte, code crp.ErrorCode, message string, data interface{}) {
if !src.HasResponse() { if !src.HasResponse() {
return return
} }
@ -120,7 +120,7 @@ func (s *RPCServlets) writeError(src crp.ServerRequestCodec, writeChan chan<- []
buf, err := src.NewResponse(nil, pErr) buf, err := src.NewResponse(nil, pErr)
if nil != err { if nil != err {
logging.Logger().Errore(err) logging.Logger().Error(err)
return return
} }
writeChan <- buf writeChan <- buf