增加异步Responder有效性判断接口

This commit is contained in:
boyce
2020-11-26 12:10:11 +08:00
parent f94fbe4164
commit 5a21324f3b
2 changed files with 5 additions and 1 deletions

View File

@@ -25,6 +25,10 @@ type RpcResponse struct {
type Responder = RequestHandler
func (r *Responder) IsInvalid() bool {
return reflect.ValueOf(*r).Pointer() == reflect.ValueOf(reqHandlerNull).Pointer()
}
//var rpcResponsePool sync.Pool
var rpcRequestPool sync.Pool
var rpcCallPool sync.Pool

View File

@@ -253,7 +253,7 @@ func (handler *RpcHandler) HandlerRpcRequest(request *RpcRequest) {
//单协程或非异步调用时直接使用预置对象
if handler.IsSingleCoroutine() && v.hasResponder==false {
iParam = v.inParam
}else{
}else if v.inParam != nil {
iParam = reflect.New(v.inParamValue.Type().Elem()).Interface()
}