大量优化

This commit is contained in:
flswld
2023-01-05 01:29:00 +08:00
parent f991480192
commit 27f16d9063
226 changed files with 2651 additions and 2484 deletions

View File

@@ -295,8 +295,13 @@ func (k *KcpConnectManager) encodeProtoToPayload(protoObj pb.Message) (cmdId uin
}
func (k *KcpConnectManager) getClientProtoObjByName(protoObjName string) pb.Message {
clientProtoObj := k.clientCmdProtoMapRefValue.MethodByName(
"GetClientProtoObjByName",
).Call([]reflect.Value{reflect.ValueOf(protoObjName)})[0].Interface().(pb.Message)
fn := k.clientCmdProtoMapRefValue.MethodByName("GetClientProtoObjByName")
ret := fn.Call([]reflect.Value{reflect.ValueOf(protoObjName)})
obj := ret[0].Interface()
if obj == nil {
logger.Error("try to get a not exist proto obj, protoObjName: %v", protoObjName)
return nil
}
clientProtoObj := obj.(pb.Message)
return clientProtoObj
}