ing
This commit is contained in:
parent
9b0d093216
commit
42c364434c
|
@ -101,7 +101,8 @@ func (rr *rpcRegistry) Invoke(codec protocol.RegistryCodec, leadingParams ...int
|
|||
|
||||
var in []reflect.Value
|
||||
pValues, pInstances := methodSpec.ParamValues()
|
||||
var lParamLen int
|
||||
|
||||
lParamLen := 0
|
||||
if nil != leadingParams {
|
||||
lParamLen = len(leadingParams)
|
||||
}
|
||||
|
@ -111,22 +112,10 @@ func (rr *rpcRegistry) Invoke(codec protocol.RegistryCodec, leadingParams ...int
|
|||
return nil, errRead
|
||||
}
|
||||
|
||||
for indexI := 0; indexI < lParamLen; indexI++ {
|
||||
i := pInstances[indexI]
|
||||
rv := reflect.ValueOf(i)
|
||||
iv := reflect.ValueOf(leadingParams[indexI])
|
||||
switch reflect.TypeOf(i).Elem().Kind() {
|
||||
case reflect.Struct:
|
||||
rv.Elem().Set(iv.Elem())
|
||||
default:
|
||||
rv.Elem().Set(iv)
|
||||
}
|
||||
}
|
||||
|
||||
pCount := len(pInstances)
|
||||
in = make([]reflect.Value, pCount+1)
|
||||
|
||||
for indexI := 0; indexI < pCount; indexI++ {
|
||||
for indexI := lParamLen; indexI < pCount; indexI++ {
|
||||
if pValues[indexI].Type().Kind() == reflect.Ptr && pValues[indexI].Type().Elem().Kind() != reflect.Struct {
|
||||
in[indexI+1] = reflect.Indirect(pValues[indexI])
|
||||
} else {
|
||||
|
@ -138,6 +127,10 @@ func (rr *rpcRegistry) Invoke(codec protocol.RegistryCodec, leadingParams ...int
|
|||
}
|
||||
in[0] = serviceSpec.ReceiverValue()
|
||||
|
||||
for indexI := 0; indexI < lParamLen; indexI++ {
|
||||
in[indexI+1] = reflect.ValueOf(leadingParams[indexI])
|
||||
}
|
||||
|
||||
// Call the service method.
|
||||
returnValues := methodSpec.Call(in)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user