Skip to content

Commit 1f4ff38

Browse files
authored
Log errors if AdvertiseOperational fails (project-chip#33773)
* Log errors if AdvertiseOperational fails * Update log text
1 parent c158260 commit 1f4ff38

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

examples/platform/linux/CommissionerMain.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ CHIP_ERROR InitCommissioner(uint16_t commissionerPort, uint16_t udcListenPort, F
216216
gCommissionerDiscoveryController.SetCommissionerCallback(&gCommissionerCallback);
217217

218218
// advertise operational since we are an admin
219-
app::DnssdServer::Instance().AdvertiseOperational();
219+
ReturnLogErrorOnFailure(app::DnssdServer::Instance().AdvertiseOperational());
220220

221221
ChipLogProgress(Support,
222222
"InitCommissioner nodeId=0x" ChipLogFormatX64 " fabric.fabricId=0x" ChipLogFormatX64 " fabricIndex=0x%x",

src/app/clusters/operational-credentials-server/operational-credentials-server.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,11 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co
703703
needRevert = false;
704704

705705
// We might have a new operational identity, so we should start advertising it right away.
706-
app::DnssdServer::Instance().AdvertiseOperational();
706+
err = app::DnssdServer::Instance().AdvertiseOperational();
707+
if (err != CHIP_NO_ERROR)
708+
{
709+
ChipLogError(AppServer, "Operational advertising failed: %" CHIP_ERROR_FORMAT, err.Format());
710+
}
707711

708712
// Notify the attributes containing fabric metadata can be read with new data
709713
MatterReportingAttributeChangeCallback(commandPath.mEndpointId, OperationalCredentials::Id,

src/app/server/CommissioningWindowManager.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,15 @@ void CommissioningWindowManager::OnPlatformEvent(const DeviceLayer::ChipDeviceEv
8484
}
8585
else if (event->Type == DeviceLayer::DeviceEventType::kOperationalNetworkEnabled)
8686
{
87-
app::DnssdServer::Instance().AdvertiseOperational();
88-
ChipLogProgress(AppServer, "Operational advertising enabled");
87+
CHIP_ERROR err = app::DnssdServer::Instance().AdvertiseOperational();
88+
if (err != CHIP_NO_ERROR)
89+
{
90+
ChipLogError(AppServer, "Operational advertising failed: %" CHIP_ERROR_FORMAT, err.Format());
91+
}
92+
else
93+
{
94+
ChipLogProgress(AppServer, "Operational advertising enabled");
95+
}
8996
}
9097
#if CONFIG_NETWORK_LAYER_BLE
9198
else if (event->Type == DeviceLayer::DeviceEventType::kCloseAllBleConnections)

0 commit comments

Comments
 (0)