-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
esp32 mdns server (re)start on connectivity change #7749
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between this and the 'StartServer' above?
The description seems the same except one says 'on network change'. When I look into the usage in Server.CPP it looks like one is 'not esp32' while the other is 'esp32'.
Could we combine them into one? If both esp32 and non-exp32 require some sort of implementation, it seems more natural to expose a single API rather than 2 APIs and ifdefing between them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was working on #7723 with @DamKast but not sure why the
!CHIP_DEVICE_LAYER_TARGET_ESP32
was there at the first place, https://github.com/project-chip/connectedhomeip/blob/0bca292/src/app/server/Server.cpp#L531, but taking it out still doesn't make it work with ESP32, so we just take the parts needed out fromhttps://github.com/project-chip/connectedhomeip/blob/3d2d9cb/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp
and put it intoserver.cpp
andmdns.cpp
so it works for all ESP32 examples, we figured itStartServer()
already works for all other platforms, no reason to keep restarting it on other platforms on network change, so there's that.If you have some input of why there's
!CHIP_DEVICE_LAYER_TARGET_ESP32
inserver.cpp
for mdns, we can look into it.(It's probably more like)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unsure about reasons - my guess is some interaction between esp32 using platform mdns and the rest using minmdns and platformmdns does not like restarting.
From an API perspective, I believe we should isolate the user of the API from platform differences. Even the 'do not call this method on some platform' seems dodgy. At most we can provide some parameter like
StartServer(cause)
and let platform code decide if that cause is sufficient for restart.As it stants, we seem to fork off the same api (with a OnNetworkChangeSuffix) and call it in a platform dependent manner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your thought on this:
Instead of registering a handler catching network changes in Server.cpp (which is not platform specific), we could just restart the mDNS server when the connectivity change event is fired from the platform implementation.
I tested it, and it seems to work at least for the
lock-app
. And that way, we don't need to introduce aStartServerOnNetworkChange();
API.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think you need
#if CHIP_DEVICE_CONFIG_ENABLE_MDNS
for the include, but need it forapp::Mdns::StartServer();
.It's also not very clean but getting better. Can also call it in platform
MdnsImpl.cpp
.It'll even be better if we can find out why platform mdns doesn't work without restarting on network change.