Update child handle validation in core_disconnect_controller() #1045
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The implementation currently doesn't skip a driver when a specific child handle is given. It might potentially call the driver's stop function and return success instead of returning not found.
This change:
Adds a flag to track whether the specified child handle was found in the driver's child list.
Adds a validation check to skip processing a driver if a specific child was requested but not found in that driver's child list.
Updates the disconnect logic to use
total_children == child_handles.len()to determine if all children should be disconnected.A couple of unit tests are added to test expected behavior based on child state when core_disconnect_controller() is called.
The new test added,
test_disconnect_specific_child_among_multiple_children()would have passed previously but tests that a specific child is requested, the child handle is present in the driver's child list, and that the child is not the only child. Under these conditions, it verifies that the driver's stop function is not called (since other child are present) and the driver remains connected to the controller.How This Was Tested
test_disconnect_specific_child_not_managed_by_driver()fails without thee change and passes with itIntegration Instructions