Skip to content

Fix race condition that causes pairing and unpairing failures#246

Merged
ikalchev merged 1 commit intoikalchev:devfrom
bdraco:race_cond_pairing_sometimes_fails
May 9, 2020
Merged

Fix race condition that causes pairing and unpairing failures#246
ikalchev merged 1 commit intoikalchev:devfrom
bdraco:race_cond_pairing_sometimes_fails

Conversation

@bdraco
Copy link
Copy Markdown
Contributor

@bdraco bdraco commented May 8, 2020

The mDNS announcement must not be updated until AFTER
the final pairing response is sent or homekit will
see that the accessory is already paired and assume
it should stop pairing as it assumes it lost the
race and another controller has paired.

This probably means safe mode can go away but I'm
not 100% sure on that.

The mDNS announcement must not be updated until AFTER
the final pairing response is sent or homekit will
see that the accessory is already paired and assume
it should stop pairing as it assumes it lost the
race and another controller has paired.
@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #246 into dev will increase coverage by 0.02%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##              dev     #246      +/-   ##
==========================================
+ Coverage   62.96%   62.99%   +0.02%     
==========================================
  Files          16       16              
  Lines        1731     1732       +1     
  Branches      185      184       -1     
==========================================
+ Hits         1090     1091       +1     
  Misses        589      589              
  Partials       52       52              
Impacted Files Coverage Δ
pyhap/hap_server.py 37.37% <0.00%> (-0.16%) ⬇️
pyhap/accessory_driver.py 65.87% <100.00%> (+0.56%) ⬆️

@bdraco
Copy link
Copy Markdown
Contributor Author

bdraco commented May 8, 2020

With Home Assistant now supporting multiple bridges, I've noticed that paired failed about 20% of the time and finally tracked it down to pairing aborting when the new mdns announcement happens which causes pairing to cancel because it sees the bridge as already paired.

@bdraco bdraco changed the title Fix many random pairing failures Fix many random pairing and unpairing failures May 8, 2020
@bdraco bdraco changed the title Fix many random pairing and unpairing failures Fix race condition that causes pairing and unpairing failures May 8, 2020
@ikalchev ikalchev merged commit dbd4ba8 into ikalchev:dev May 9, 2020
bdraco added a commit to bdraco/home-assistant that referenced this pull request May 12, 2020
Fix race condition that causes pairing and unpairing failures. ikalchev/HAP-python#246
Fix loop on dropped connections that causes temporary stalls and connection loss. ikalchev/HAP-python#249
Fix exception on missing video fields. ikalchev/HAP-python#245
bdraco added a commit to home-assistant/core that referenced this pull request May 12, 2020
Fix race condition that causes pairing and unpairing failures. ikalchev/HAP-python#246
Fix loop on dropped connections that causes temporary stalls and connection loss. ikalchev/HAP-python#249
Fix exception on missing video fields. ikalchev/HAP-python#245
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants