mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-27 01:04:47 +08:00
Rpc内存优化
This commit is contained in:
@@ -49,6 +49,7 @@ type RpcHandler struct {
|
|||||||
callRequest chan *RpcRequest
|
callRequest chan *RpcRequest
|
||||||
rpcHandler IRpcHandler
|
rpcHandler IRpcHandler
|
||||||
mapFunctions map[string]RpcMethodInfo
|
mapFunctions map[string]RpcMethodInfo
|
||||||
|
mapRawFunctions map[int]
|
||||||
funcRpcClient FuncRpcClient
|
funcRpcClient FuncRpcClient
|
||||||
funcRpcServer FuncRpcServer
|
funcRpcServer FuncRpcServer
|
||||||
|
|
||||||
@@ -257,9 +258,7 @@ func (handler *RpcHandler) HandlerRpcRequest(request *RpcRequest) {
|
|||||||
var err error
|
var err error
|
||||||
var iParam interface{}
|
var iParam interface{}
|
||||||
//单协程或非异步调用时直接使用预置对象
|
//单协程或非异步调用时直接使用预置对象
|
||||||
if handler.IsSingleCoroutine() && v.hasResponder==false {
|
if v.inParam!= nil {
|
||||||
iParam = v.inParam
|
|
||||||
}else if v.inParam != nil {
|
|
||||||
iParam = reflect.New(v.inParamValue.Type().Elem()).Interface()
|
iParam = reflect.New(v.inParamValue.Type().Elem()).Interface()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,8 +310,6 @@ func (handler *RpcHandler) HandlerRpcRequest(request *RpcRequest) {
|
|||||||
if v.outParamValue.IsValid() {
|
if v.outParamValue.IsValid() {
|
||||||
if request.localReply!=nil {
|
if request.localReply!=nil {
|
||||||
oParam = reflect.ValueOf(request.localReply) //输出参数
|
oParam = reflect.ValueOf(request.localReply) //输出参数
|
||||||
}else if handler.IsSingleCoroutine()==true{
|
|
||||||
oParam = v.outParamValue
|
|
||||||
}else{
|
}else{
|
||||||
oParam = reflect.New(v.outParamValue.Type().Elem())
|
oParam = reflect.New(v.outParamValue.Type().Elem())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user