fjpanag commented on PR #9497: URL: https://github.com/apache/nuttx/pull/9497#issuecomment-1600759466
My current solution to this very specific problem is to add a `min_sd` [here](https://github.com/fjpanag/code_for_nuttx/blob/main/mqtt_broker/mqtt_br_server.c#L121) as it is done with `max_sd`. Then [this](https://github.com/fjpanag/code_for_nuttx/blob/main/mqtt_broker/mqtt_br_server.c#L150) loop starts of from `min_sd`, instead of 0: ``` for (int sd = min_sd; (sd <= max_sd) && (available > 0); sd++) ``` This works because `min_sd` now is an actual protected sd. The loop (and thus `FD_ISSET()`) will only check the protected range of descriptors. I guess this will also slightly increase performance even without `CONFIG_FDCHECK`, as fd 0 to 2 will now not be checked (as they aren't actually needed). --- I would insist however that `fdcheck_restore()` should check the validity of its arguments. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
