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

SetUpCodePairer: don't use DeviceDiscoveryDelegate #12320

Merged
merged 3 commits into from
Dec 3, 2021

Conversation

cecille
Copy link
Contributor

@cecille cecille commented Nov 29, 2021

Problem

SetUpCodePairer replaces the delegate that was set up during commissioner initialization and doesn't put it back. There is also a chance of a race from spurious dns-sd responses.

Change overview

This class replaces the device discovery delegate that gets passed
in in the commissioning parameters which will cause the original
delegate to stop receiving callbacks if this class is used.
Instead, just have the commissioner notify this class directly.
The commissioner owns this part, so it doesn't need to use a derived
delegate because we know what we're talking to.

Also adding a discovery filter. This wasn't as necessary before
because the class would stop receiving notifications by setting the
delegate to null. However, that is still a race because it is
possible to get spurious mdns responses.

Testing

With #12319, tested manual and qr code pairing.

@github-actions
Copy link

github-actions bot commented Nov 29, 2021

PR #12320: Size comparison from 7d55d2e to 0304275

Full report (14 builds for efr32, esp32, k32w, p6, qpg)
platform target config section 7d55d2e 0304275 change % change
efr32 lighting-app BRD4161A (read only) 762200 762200 0 0.0
(read/write) 119836 119836 0 0.0
.bss 118012 118012 0 0.0
.data 1820 1820 0 0.0
.text 762192 762192 0 0.0
BRD4161A+rpc (read only) 790632 790632 0 0.0
(read/write) 138132 138132 0 0.0
.bss 136212 136212 0 0.0
.data 1920 1920 0 0.0
.text 790624 790624 0 0.0
lock-app BRD4161A (read only) 736144 736144 0 0.0
(read/write) 117540 117540 0 0.0
.bss 115764 115764 0 0.0
.data 1776 1776 0 0.0
.text 736136 736136 0 0.0
window-app BRD4161A (read only) 739208 739208 0 0.0
(read/write) 117972 117972 0 0.0
.bss 116188 116188 0 0.0
.data 1784 1784 0 0.0
.text 739200 739200 0 0.0
esp32 all-clusters-app c3devkit (read only) 836536 836536 0 0.0
(read/write) 1224474 1224474 0 0.0
.dram0.bss 59144 59144 0 0.0
.dram0.data 14100 14100 0 0.0
.flash.rodata 165968 165968 0 0.0
.flash.text 836536 836536 0 0.0
.iram0.text 61394 61394 0 0.0
m5stack (read only) 907919 907919 0 0.0
(read/write) 423692 423692 0 0.0
.dram0.bss 64536 64536 0 0.0
.dram0.data 34072 34072 0 0.0
.flash.rodata 193804 193804 0 0.0
.flash.text 902535 902535 0 0.0
.iram0.text 122943 122943 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 723320 723320 0 0.0
.bss 78292 78292 0 0.0
.data 1956 1956 0 0.0
.text 637272 637272 0 0.0
lock-app k32w061+debug (read/write) 612392 612392 0 0.0
.bss 68740 68740 0 0.0
.data 1920 1920 0 0.0
.text 535932 535932 0 0.0
shell k32w061+debug (read/write) 677712 677712 0 0.0
.bss 79892 79892 0 0.0
.data 1892 1892 0 0.0
.text 590128 590128 0 0.0
p6 all-clusters-app default (read/write) 2311304 2311304 0 0.0
.bss 114688 114688 0 0.0
.data 2544 2544 0 0.0
.heap 916112 916112 0 0.0
.text 1269568 1269568 0 0.0
lock-app default (read/write) 2223120 2223120 0 0.0
.bss 100976 100976 0 0.0
.data 2416 2416 0 0.0
.heap 929952 929952 0 0.0
.text 1181384 1181384 0 0.0
qpg lighting-app qpg6100+debug (read only) 503096 503096 0 0.0
(read/write) 114144 114144 0 0.0
.bss 50400 50400 0 0.0
.data 1024 1024 0 0.0
.text 497776 497776 0 0.0
lock-app qpg6100+debug (read only) 475804 475804 0 0.0
(read/write) 114140 114140 0 0.0
.bss 49272 49272 0 0.0
.data 980 980 0 0.0
.text 470484 470484 0 0.0
persistent-storage-app qpg6100+debug (read only) 105424 105424 0 0.0
(read/write) 114138 114138 0 0.0
.bss 12002 12002 0 0.0
.data 276 276 0 0.0
.text 100104 100104 0 0.0

Copy link
Contributor

@vivien-apple vivien-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw I'm trying to get the dns-sd dispatch mechanism to support multiple delegates in #12261

src/controller/SetUpCodePairer.cpp Outdated Show resolved Hide resolved
src/controller/SetUpCodePairer.cpp Outdated Show resolved Hide resolved
@pullapprove pullapprove bot requested a review from vijs November 30, 2021 15:19
@andy31415
Copy link
Contributor

/rebase

This class replaces the device discovery delegate that gets passed
in in the commissioning parameters which will cause the original
delegate to stop receiving callbacks if this class is used.
Instead, just have the commissioner notify this class directly.
The commissioner owns this part, so it doesn't need to use a derived
delegate because we know what we're talking to.

Also adding a discovery filter. This wasn't as necessary before
because the class would stop receiving notifications by setting the
delegate to null. However, that is still a race because it is
possible to get spurious mdns responses.
@github-actions
Copy link

github-actions bot commented Dec 3, 2021

PR #12320: Size comparison from fc07dcf to c5571a0

Increases (2 builds for linux)
platform target config section fc07dcf c5571a0 change % change
linux chip-tool debug (read only) 6635109 6635213 104 0.0
.text 5919253 5919381 128 0.0
tv-app debug .bss 247256 247288 32 0.0
.text 1700754 1700786 32 0.0
Decreases (1 build for linux)
platform target config section fc07dcf c5571a0 change % change
linux tv-app debug (read only) 2029761 2029745 -16 -0.0
.data.rel.ro 64200 64168 -32 -0.0
Full report (39 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section fc07dcf c5571a0 change % change
efr32 lighting-app BRD4161A (read only) 751784 751784 0 0.0
(read/write) 120032 120032 0 0.0
.bss 118200 118200 0 0.0
.data 1828 1828 0 0.0
.text 751776 751776 0 0.0
BRD4161A+rpc (read only) 780440 780440 0 0.0
(read/write) 138336 138336 0 0.0
.bss 136400 136400 0 0.0
.data 1936 1936 0 0.0
.text 780432 780432 0 0.0
lock-app BRD4161A (read only) 725800 725800 0 0.0
(read/write) 117736 117736 0 0.0
.bss 115952 115952 0 0.0
.data 1784 1784 0 0.0
.text 725792 725792 0 0.0
window-app BRD4161A (read only) 729096 729096 0 0.0
(read/write) 118168 118168 0 0.0
.bss 116376 116376 0 0.0
.data 1792 1792 0 0.0
.text 729088 729088 0 0.0
esp32 all-clusters-app c3devkit (read only) 847284 847284 0 0.0
(read/write) 1224130 1224130 0 0.0
.dram0.bss 56616 56616 0 0.0
.dram0.data 14052 14052 0 0.0
.flash.rodata 168000 168000 0 0.0
.flash.text 847284 847284 0 0.0
.iram0.text 61394 61394 0 0.0
m5stack (read only) 917759 917759 0 0.0
(read/write) 423092 423092 0 0.0
.dram0.bss 62000 62000 0 0.0
.dram0.data 34016 34016 0 0.0
.flash.rodata 195796 195796 0 0.0
.flash.text 912375 912375 0 0.0
.iram0.text 122943 122943 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 728696 728696 0 0.0
.bss 79312 79312 0 0.0
.data 1860 1860 0 0.0
.text 641724 641724 0 0.0
lock-app k32w061+debug (read/write) 617792 617792 0 0.0
.bss 69752 69752 0 0.0
.data 1824 1824 0 0.0
.text 540416 540416 0 0.0
shell k32w061+debug (read/write) 683684 683684 0 0.0
.bss 81400 81400 0 0.0
.data 1796 1796 0 0.0
.text 594688 594688 0 0.0
linux all-clusters-app debug (read only) 1845873 1845873 0 0.0
(read/write) 124648 124648 0 0.0
.bss 50928 50928 0 0.0
.data 1120 1120 0 0.0
.data.rel.ro 67184 67184 0 0.0
.dynamic 592 592 0 0.0
.got 4120 4120 0 0.0
.init 27 27 0 0.0
.init_array 688 688 0 0.0
.rodata 149109 149109 0 0.0
.text 1553826 1553826 0 0.0
bridge-app debug+rpc (read only) 1431021 1431021 0 0.0
(read/write) 74648 74648 0 0.0
.bss 36272 36272 0 0.0
.data 1728 1728 0 0.0
.data.rel.ro 31560 31560 0 0.0
.dynamic 592 592 0 0.0
.got 3992 3992 0 0.0
.init 27 27 0 0.0
.init_array 480 480 0 0.0
.rodata 121044 121044 0 0.0
.text 1205077 1205077 0 0.0
chip-tool debug (read only) 6635109 6635213 104 0.0
(read/write) 201256 201256 0 0.0
.bss 34536 34536 0 0.0
.data 1024 1024 0 0.0
.data.rel.ro 160024 160024 0 0.0
.dynamic 592 592 0 0.0
.got 4496 4496 0 0.0
.init 27 27 0 0.0
.init_array 568 568 0 0.0
.rodata 307384 307384 0 0.0
.text 5919253 5919381 128 0.0
lighting-app debug+rpc (read only) 1716161 1716161 0 0.0
(read/write) 107680 107680 0 0.0
.bss 41968 41968 0 0.0
.data 1280 1280 0 0.0
.data.rel.ro 59056 59056 0 0.0
.dynamic 608 608 0 0.0
.got 4144 4144 0 0.0
.init 27 27 0 0.0
.init_array 616 616 0 0.0
.rodata 141681 141681 0 0.0
.text 1431810 1431810 0 0.0
ota-provider-app debug (read only) 1391625 1391625 0 0.0
(read/write) 72848 72848 0 0.0
.bss 38848 38848 0 0.0
.data 928 928 0 0.0
.data.rel.ro 27880 27880 0 0.0
.dynamic 592 592 0 0.0
.got 4056 4056 0 0.0
.init 27 27 0 0.0
.init_array 520 520 0 0.0
.rodata 121800 121800 0 0.0
.text 1165138 1165138 0 0.0
ota-requestor-app debug (read only) 1498297 1498297 0 0.0
(read/write) 76816 76816 0 0.0
.bss 40992 40992 0 0.0
.data 992 992 0 0.0
.data.rel.ro 29592 29592 0 0.0
.dynamic 592 592 0 0.0
.got 4072 4072 0 0.0
.init 27 27 0 0.0
.init_array 552 552 0 0.0
.rodata 134288 134288 0 0.0
.text 1255314 1255314 0 0.0
shell debug (read only) 822041 822041 0 0.0
(read/write) 60616 60616 0 0.0
.bss 16936 16936 0 0.0
.data 256 256 0 0.0
.data.rel.ro 38936 38936 0 0.0
.dynamic 592 592 0 0.0
.got 3520 3520 0 0.0
.init 27 27 0 0.0
.init_array 344 344 0 0.0
.rodata 83634 83634 0 0.0
.text 631570 631570 0 0.0
tv-app debug (read only) 2029761 2029745 -16 -0.0
(read/write) 320032 320032 0 0.0
.bss 247256 247288 32 0.0
.data 2768 2768 0 0.0
.data.rel.ro 64200 64168 -32 -0.0
.dynamic 592 592 0 0.0
.got 4456 4456 0 0.0
.init 27 27 0 0.0
.init_array 736 736 0 0.0
.rodata 174216 174216 0 0.0
.text 1700754 1700786 32 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2306472 2306472 0 0.0
.bss 179676 179676 0 0.0
.data 5184 5184 0 0.0
.heap 851584 851584 0 0.0
.text 1269048 1269048 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2296296 2296296 0 0.0
.bss 173304 173304 0 0.0
.data 5496 5496 0 0.0
.heap 857648 857648 0 0.0
.text 1258896 1258896 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2269520 2269520 0 0.0
.bss 172120 172120 0 0.0
.data 5496 5496 0 0.0
.heap 858832 858832 0 0.0
.text 1232120 1232120 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1140008 1140008 0 0.0
.bss 11756 11756 0 0.0
.data 4376 4376 0 0.0
.heap 1020312 1020312 0 0.0
.text 103392 103392 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2047408 2047408 0 0.0
.bss 156732 156732 0 0.0
.data 4872 4872 0 0.0
.heap 874840 874840 0 0.0
.text 1010008 1010008 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 891715 891715 0 0.0
bss 113756 113756 0 0.0
rodata 99588 99588 0 0.0
text 602824 602824 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 855091 855091 0 0.0
bss 110104 110104 0 0.0
rodata 90948 90948 0 0.0
text 577820 577820 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 817626 817626 0 0.0
bss 115128 115128 0 0.0
rodata 94844 94844 0 0.0
text 533164 533164 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 862683 862683 0 0.0
bss 110792 110792 0 0.0
rodata 95324 95324 0 0.0
text 581188 581188 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 788838 788838 0 0.0
bss 112204 112204 0 0.0
rodata 90616 90616 0 0.0
text 511620 511620 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 497463 497463 0 0.0
bss 51820 51820 0 0.0
rodata 45852 45852 0 0.0
text 339492 339492 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 868523 868523 0 0.0
bss 110928 110928 0 0.0
rodata 97060 97060 0 0.0
text 585084 585084 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 861763 861763 0 0.0
bss 110808 110808 0 0.0
rodata 95196 95196 0 0.0
text 580316 580316 0 0.0
shell nrf52840dk_nrf52840 (read/write) 779907 779907 0 0.0
bss 109696 109696 0 0.0
rodata 73792 73792 0 0.0
text 521920 521920 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 694934 694934 0 0.0
bss 110680 110680 0 0.0
rodata 68432 68432 0 0.0
text 442524 442524 0 0.0
p6 all-clusters-app default (read/write) 2339024 2339024 0 0.0
.bss 107860 107860 0 0.0
.data 2456 2456 0 0.0
.heap 923024 923024 0 0.0
.text 1297288 1297288 0 0.0
light-app default (read/write) 2279744 2279744 0 0.0
.bss 98536 98536 0 0.0
.data 2336 2336 0 0.0
.heap 932472 932472 0 0.0
.text 1238008 1238008 0 0.0
lock-app default (read/write) 2255240 2255240 0 0.0
.bss 97192 97192 0 0.0
.data 2296 2296 0 0.0
.heap 933856 933856 0 0.0
.text 1213504 1213504 0 0.0
qpg lighting-app qpg6100+debug (read only) 510480 510480 0 0.0
(read/write) 122332 122332 0 0.0
.bss 80272 80272 0 0.0
.data 964 964 0 0.0
.text 505160 505160 0 0.0
lock-app qpg6100+debug (read only) 483392 483392 0 0.0
(read/write) 122332 122332 0 0.0
.bss 79184 79184 0 0.0
.data 916 916 0 0.0
.text 478072 478072 0 0.0
persistent-storage-app qpg6100+debug (read only) 108208 108208 0 0.0
(read/write) 122332 122332 0 0.0
.bss 36696 36696 0 0.0
.data 292 292 0 0.0
.text 102888 102888 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 794794 794794 0 0.0
bss 80332 80332 0 0.0
noinit 37160 37160 0 0.0
text 554586 554586 0 0.0

@andy31415 andy31415 merged commit 3a339bc into project-chip:master Dec 3, 2021
@cecille cecille deleted the setupcodepairer branch April 1, 2022 00:02
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.

5 participants