Skip to content

Make ServiceInfo first question QU #852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Jun 27, 2021

  • We want an immediate response when making a request with ServiceInfo
    by asking a QU question, most responders will not delay the response
    and respond right away to our question. This also improves compatibility
    with split networks as we may not have been able to see the response
    otherwise. If the responder has not multicast the record recently
    it may still choose to do so in addition to responding via unicast

  • Reduces traffic when there are multiple zeroconf instances running
    on the network running ServiceBrowsers

  • If we don't get an answer on the first try, we ask a QM question
    in the event we can't receive a unicast response for some reason

  • This change puts ServiceInfo inline with ServiceBrowser which
    also asks the first question as QU since ServiceInfo is commonly
    called from ServiceBrowser callbacks

closes #851

- We want an immediate response when making a request with ServiceInfo
  by asking a QU question, most responders will not delay the response
  and respond right away to our question. This also improves compatibility
  with split networks as we may not have been able to see the response
  otherwise.
@bdraco
Copy link
Member Author

bdraco commented Jun 27, 2021

Working as expected

2021-06-27 19:06:14 DEBUG (MainThread) [zeroconf] Sending to (192.168.107.5, 5353) (57 bytes #1) <DNSOutgoing:{multicast=False, flags=33792, questions=[], answers=[(record[a,in-unique,HASS-Bridge-0MCY-BCDC19.local.]=120/119,192.168.107.5, 0)], authorities=[], additionals=[]}> as b'\x00\x00\x84\x00\x00\x00\x00\x01\x00\x00\x00\x00\x17HASS-Bridge-0MCY-BCDC19\x05local\x00\x00\x01\x00\x01\x00\x00\x00x\x00\x04\xc0\xa8k\x05'...
2021-06-27 19:06:14 DEBUG (MainThread) [zeroconf] Sending to (192.168.107.5, 5353) (48 bytes #1) <DNSOutgoing:{multicast=False, flags=33792, questions=[], answers=[(record[a,in-unique,HA89SSO-D98A9A.local.]=120/119,192.168.107.5, 0)], authorities=[], additionals=[]}> as b'\x00\x00\x84\x00\x00\x00\x00\x01\x00\x00\x00\x00\x0eHA89SSO-D98A9A\x05local\x00\x00\x01\x00\x01\x00\x00\x00x\x00\x04\xc0\xa8k\x05'...
2021-06-27 19:06:14 DEBUG (MainThread) [zeroconf] Sending to (192.168.107.5, 5353) (59 bytes #1) <DNSOutgoing:{multicast=False, flags=33792, questions=[], answers=[(record[a,in-unique,Master-Bed-Harmony-8C0504.local.]=120/119,192.168.107.5, 0)], authorities=[], additionals=[]}> as b'\x00\x00\x84\x00\x00\x00\x00\x01\x00\x00\x00\x00\x19Master-Bed-Harmony-8C0504\x05local\x00\x00\x01\x00\x01\x00\x00\x00x\x00\x04\xc0\xa8k\x05'...
2021-06-27 19:06:14 DEBUG (MainThread) [zeroconf] Sending to (192.168.107.5, 5353) (57 bytes #1) <DNSOutgoing:{multicast=False, flags=33792, questions=[], answers=[(record[a,in-unique,HASS-Bridge-0MCY-BCDC19.local.]=120/119,192.168.107.5, 0)], authorities=[], additionals=[]}> as b'\x00\x00\x84\x00\x00\x00\x00\x01\x00\x00\x00\x00\x17HASS-Bridge-0MCY-BCDC19\x05local\x00\x00\x01\x00\x01\x00\x00\x00x\x00\x04\xc0\xa8k\x05'...
2021-06-27 19:06:14 DEBUG (MainThread) [zeroconf] Sending to (192.168.107.5, 5353) (48 bytes #1) <DNSOutgoing:{multicast=False, flags=33792, questions=[], answers=[(record[a,in-unique,HA89SSO-D98A9A.local.]=120/119,192.168.107.5, 0)], authorities=[], additionals=[]}> as b'\x00\x00\x84\x00\x00\x00\x00\x01\x00\x00\x00\x00\x0eHA89SSO-D98A9A\x05local\x00\x00\x01\x00\x01\x00\x00\x00x\x00\x04\xc0\xa8k\x05'...

@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2021

Codecov Report

Merging #852 (19b301a) into master (8c9d1d8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #852   +/-   ##
=======================================
  Coverage   98.63%   98.63%           
=======================================
  Files          22       22           
  Lines        2339     2341    +2     
  Branches      398      398           
=======================================
+ Hits         2307     2309    +2     
  Misses         21       21           
  Partials       11       11           
Impacted Files Coverage Δ
zeroconf/_services/info.py 99.56% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c9d1d8...19b301a. Read the comment docs.

@bdraco bdraco merged commit 76e0b05 into python-zeroconf:master Jun 27, 2021
@bdraco bdraco deleted the service_info_ask_qu_question_first branch June 27, 2021 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ServiceInfo should ask the first question QU if caller doesn't specify
2 participants