Skip to content

infinite loop #10

@cntasc

Description

@cntasc

if you enter an non existing service name --> found would be never true; anti_recursive is counting up endless since an or || it will be always true i think it should be while (anti_recusive < 100 && !found);

/**
* Get service methods from grpc descriptor
*
* @param descriptor
* @param service
* @Protected
*/
getServiceMethods(descriptor: grpc.GrpcObject, service: string): Array
{
let anti_recusive = 0
let actualDescriptor : any = descriptor;
let found = false;
const path = this.generateServicePath(service);
do {
const service = path.pop();
if (service && service in actualDescriptor){
actualDescriptor = actualDescriptor[service];
found = true;
}
anti_recusive++;
}while(anti_recusive < 100 || !found);
if ('service' in actualDescriptor) {
return Object.entries(actualDescriptor.service)
.map(([methodName, methodDefinition]) => ({
name: methodName,
definition: methodDefinition as MethodDefinition<any, any>
}));
}
throw new ReflectionRequestException('Not found service');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions