Skip to content
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

Make Darwin HostNameRegistrar safer to use. #25983

Conversation

bzbarsky-apple
Copy link
Contributor

There are two main changes here:

  1. When we shut down the Matter stack, we should remove all our advertisements adn stop monitoring for network interface changes. That's what the change to ChipDnssdShutdown does.

  2. It's theoretically possible for the block HostNameRegistrar passes to nw_path_monitor_set_update_handler to run after the HostNameRegistrar is destroyed. Guard against that with a shared_ptr that keeps track of the liveness state of the HostNameRegistrar.

The changes to the member initialization of HostNameRegistrar are just for safety's sake, in case its destructor ever gets called without Init() having been called first. Right now that is not possible, but better to not rely on that.

There are two main changes here:

1) When we shut down the Matter stack, we should remove all our advertisements
adn stop monitoring for network interface changes.  That's what the change to
ChipDnssdShutdown does.

2) It's theoretically possible for the block HostNameRegistrar passes to
nw_path_monitor_set_update_handler to run after the HostNameRegistrar is
destroyed.  Guard against that with a shared_ptr that keeps track of the
liveness state of the HostNameRegistrar.

The changes to the member initialization of HostNameRegistrar are just for
safety's sake, in case its destructor ever gets called without Init() having
been called first.  Right now that is not possible, but better to not rely on
that.
@github-actions
Copy link

github-actions bot commented Apr 5, 2023

PR #25983: Size comparison from 7c2e7db to 5058593

Decreases (1 build for cc32xx)
platform target config section 7c2e7db 5058593 change % change
cc32xx lock CC3235SF_LAUNCHXL .debug_info 20302987 20302986 -1 -0.0
Full report (6 builds for cc32xx, linux, mbed, qpg)
platform target config section 7c2e7db 5058593 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 642745 642745 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 933099 933099 0 0.0
.debug_aranges 87608 87608 0 0.0
.debug_frame 301328 301328 0 0.0
.debug_info 20302987 20302986 -1 -0.0
.debug_line 2679748 2679748 0 0.0
.debug_loc 2824679 2824679 0 0.0
.debug_ranges 286200 286200 0 0.0
.debug_str 3039406 3039406 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104289 104289 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 377422 377422 0 0.0
.symtab 256768 256768 0 0.0
.text 536336 536336 0 0.0
linux chip-tool-ipv6only arm64 (read only) 12113692 12113692 0 0.0
(read/write) 742616 742616 0 0.0
.bss 34392 34392 0 0.0
.data 3008 3008 0 0.0
.data.rel.ro 684496 684496 0 0.0
.dynamic 560 560 0 0.0
.got 15504 15504 0 0.0
.init 24 24 0 0.0
.init_array 216 216 0 0.0
.rodata 566156 566156 0 0.0
.text 9785268 9785268 0 0.0
thermostat-no-ble arm64 (read only) 2500492 2500492 0 0.0
(read/write) 145192 145192 0 0.0
.bss 56344 56344 0 0.0
.data 1784 1784 0 0.0
.data.rel.ro 77648 77648 0 0.0
.dynamic 560 560 0 0.0
.got 5360 5360 0 0.0
.init 24 24 0 0.0
.init_array 432 432 0 0.0
.rodata 129400 129400 0 0.0
.text 2108784 2108784 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2465472 2465472 0 0.0
.bss 215964 215964 0 0.0
.data 5880 5880 0 0.0
.text 1428116 1428116 0 0.0
qpg lighting-app qpg6105+debug (read/write) 1153440 1153440 0 0.0
.bss 97404 97404 0 0.0
.data 852 852 0 0.0
.text 600536 600536 0 0.0
lock-app qpg6105+debug (read/write) 1122048 1122048 0 0.0
.bss 92540 92540 0 0.0
.data 856 856 0 0.0
.text 569148 569148 0 0.0

@bzbarsky-apple
Copy link
Contributor Author

Fast-tracking platform-specific fix with platform owner review.

@bzbarsky-apple bzbarsky-apple merged commit 1fec0d2 into project-chip:master Apr 5, 2023
@bzbarsky-apple bzbarsky-apple deleted the cleaner-darwin-hostname-registrar-shutdown branch April 5, 2023 16:59
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.

3 participants