Skip to content

Simplify the can_send_to check#990

Merged
bdraco merged 1 commit into
python-zeroconf:masterfrom
bdraco:simplify_can_send_to
Sep 19, 2021
Merged

Simplify the can_send_to check#990
bdraco merged 1 commit into
python-zeroconf:masterfrom
bdraco:simplify_can_send_to

Conversation

@bdraco
Copy link
Copy Markdown
Member

@bdraco bdraco commented Sep 19, 2021

  • There is no need to call can_send_to when we derive the target
    since we already know we can send to it.

  • can_send_to was converting the addr string into an ipaddress object
    to check if it was IPv4 or IPv6. Since this all happens internally there
    was no need for the additional validation and check. We can use a must
    more simple test.

@bdraco
Copy link
Copy Markdown
Member Author

bdraco commented Sep 19, 2021

Screen Shot 2021-09-18 at 11 02 48 PM

Screen Shot 2021-09-18 at 10 50 21 PM

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 19, 2021

Codecov Report

Merging #990 (9df5203) into master (34f4a26) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #990   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines         2502      2502           
  Branches       408       408           
=========================================
  Hits          2502      2502           
Impacted Files Coverage Δ
zeroconf/__init__.py 100.00% <ø> (ø)
zeroconf/_core.py 100.00% <100.00%> (ø)
zeroconf/_utils/net.py 100.00% <100.00%> (ø)

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 34f4a26...9df5203. Read the comment docs.

@bdraco
Copy link
Copy Markdown
Member Author

bdraco commented Sep 19, 2021

Screen Shot 2021-09-18 at 11 33 13 PM

can_send_to mostly goes away

- There is no need to call can_send_to when we derive the target

- can_send_to was converting the addr string into an ipaddress object
  to check if it was IPv4 or IPv6. Since this all happens internally there
  was no need for the additional validation and check. We can use a must
  more simple test.
@bdraco bdraco force-pushed the simplify_can_send_to branch from 2c23afe to 9df5203 Compare September 19, 2021 09:38
@bdraco bdraco marked this pull request as ready for review September 19, 2021 22:49
@bdraco bdraco merged commit 1887c55 into python-zeroconf:master Sep 19, 2021
@bdraco bdraco deleted the simplify_can_send_to branch September 19, 2021 22:49
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.

2 participants