ing
This commit is contained in:
parent
39d7640d8b
commit
a9a6e238c7
|
@ -110,10 +110,13 @@ func (s *ContainerServlets) Handle(servletCtx server.ServletCtx,
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
src crp.ServerRequestCodec
|
src crp.ServerRequestCodec
|
||||||
result interface{}
|
messageType int
|
||||||
replyBuff []byte
|
message []byte
|
||||||
err error
|
result interface{}
|
||||||
|
resMessageType int
|
||||||
|
resMessage []byte
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
if nil != _containerType {
|
if nil != _containerType {
|
||||||
|
@ -130,8 +133,9 @@ func (s *ContainerServlets) Handle(servletCtx server.ServletCtx,
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
messageType, message = socketMessage()
|
||||||
// grpc exec method call
|
// grpc exec method call
|
||||||
src, err = s.RPCServerCodec.NewRequest(msg)
|
src, err = s.RPCServerCodec.NewRequest(messageType, message)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.Logger().Error(err)
|
logging.Logger().Error(err)
|
||||||
break
|
break
|
||||||
|
@ -151,21 +155,21 @@ func (s *ContainerServlets) Handle(servletCtx server.ServletCtx,
|
||||||
if !src.HasResponse() {
|
if !src.HasResponse() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
replyBuff, err = src.NewResponse(result, err)
|
resMessageType, resMessage, err = src.NewResponse(result, err)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.Logger().Error(err)
|
logging.Logger().Error(err)
|
||||||
s.writeError(src, writeChan, crp.E_INTERNAL, "", err)
|
s.writeError(src, writeChan, crp.E_INTERNAL, "", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
writeChan <- replyBuff
|
writeChan <- css.MakeSocketMessage(resMessageType, resMessage)
|
||||||
case <-stopChan:
|
case <-stopChan:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ContainerServlets) writeError(src crp.ServerRequestCodec, writeChan chan<- []byte, code crp.ErrorCode, message string, data interface{}) {
|
func (s *ContainerServlets) writeError(src crp.ServerRequestCodec, writeChan chan<- css.SocketMessage, code crp.ErrorCode, message string, data interface{}) {
|
||||||
if !src.HasResponse() {
|
if !src.HasResponse() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -176,10 +180,10 @@ func (s *ContainerServlets) writeError(src crp.ServerRequestCodec, writeChan cha
|
||||||
Data: data,
|
Data: data,
|
||||||
}
|
}
|
||||||
|
|
||||||
buf, err := src.NewResponse(nil, pErr)
|
messageType, resMessage, err := src.NewResponse(nil, pErr)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.Logger().Error(err)
|
logging.Logger().Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
writeChan <- buf
|
writeChan <- css.MakeSocketMessage(messageType, resMessage)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user