Don't mask BIG (sync) establishment failure with a KeyError#959
Open
devitwise wants to merge 1 commit into
Open
Don't mask BIG (sync) establishment failure with a KeyError#959devitwise wants to merge 1 commit into
devitwise wants to merge 1 commit into
Conversation
On a BIG or BIG-sync establishment failure the event handler removes the bigs / big_syncs entry and emits ESTABLISHMENT_FAILURE, which makes the awaited future raise hci.HCI_Error. create_big()/create_big_sync() then ran `del self.bigs[big_handle]` / `del self.big_syncs[big_handle]` in their `except hci.HCI_Error` clause on an entry that was already gone, raising `KeyError: 0` and discarding the real HCI status. Pop with a default instead of deleting, matching the idempotent pattern already used in on_big_termination(). The HCI_Error now propagates with its status intact. Fixes google#954.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
@googlebot I signed it! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #954.
On a BIG or BIG-sync establishment failure, the event handler (
on_big_establishment/on_big_sync_establishment) removes thebigs/big_syncsentry and emitsESTABLISHMENT_FAILURE, which makes the awaited future raisehci.HCI_Error.create_big()/create_big_sync()then randel self.bigs[big_handle]/del self.big_syncs[big_handle]in theirexcept hci.HCI_Errorclause on an entry that was already gone, raisingKeyError: 0and discarding the real HCI status (e.g. a wrong broadcast code surfaces asKeyError: 0instead ofCONNECTION_TERMINATED_DUE_TO_MIC_FAILURE).This pops with a default instead of deleting, matching the idempotent pattern already used in
on_big_termination(). TheHCI_Errornow propagates with its status intact.Test:
tests/device_test.py::test_create_big_sync_failure_propagates_hci_errorreproduces the failure sequence (handler removes the entry, then theexceptclause runs); it raisesKeyError: 0before the change and the correctHCI_Errorafter. Fulldevice_test.py+hci_test.pysuites green.