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

Darwin: Avoid calling DnssdServer::StartServer() when not initialized #34465

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/server/Dnssd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void DnssdServer::GetPrimaryOrFallbackMACAddress(chip::MutableByteSpan mac)
/// Set MDNS operational advertisement
CHIP_ERROR DnssdServer::AdvertiseOperational()
{
VerifyOrDie(mFabricTable != nullptr);
VerifyOrReturnError(mFabricTable != nullptr, CHIP_ERROR_INCORRECT_STATE);

for (const FabricInfo & fabricInfo : *mFabricTable)
{
Expand Down
2 changes: 1 addition & 1 deletion src/controller/CHIPDeviceControllerSystemState.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class DeviceControllerSystemState
mGroupDataProvider != nullptr && mReportScheduler != nullptr && mTimerDelegate != nullptr &&
mSessionKeystore != nullptr && mSessionResumptionStorage != nullptr && mBDXTransferServer != nullptr;
};
bool IsShutDown() { return mHaveShutDown; }
bool IsShutDown() const { return mHaveShutDown; }

System::Layer * SystemLayer() const { return mSystemLayer; };
Inet::EndPointManager<Inet::TCPEndPoint> * TCPEndPointManager() const { return mTCPEndPointManager; };
Expand Down
9 changes: 4 additions & 5 deletions src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -889,11 +889,10 @@ - (void)resetOperationalAdvertising
// If we're not advertising, then there's no need to reset anything.
VerifyOrReturn(_advertiseOperational);

// If there are no running controllers there will be no advertisements to reset.
{
std::lock_guard lock(_controllersLock);
VerifyOrReturn(_controllers.count > 0);
}
// Ensure the stack is running. We can't look at _controllers to determine this
// reliably because it gets updated early during controller startup from off-queue.
auto systemState = _controllerFactory->GetSystemState();
VerifyOrReturn(systemState != nullptr && !systemState->IsShutDown());
ksperling-apple marked this conversation as resolved.
Show resolved Hide resolved

// StartServer() is the only API we have for resetting DNS-SD advertising.
// It sure would be nice if there were a "restart" that was a no-op if the
Expand Down
Loading