Skip to content

Commit 5b3681d

Browse files
update chef force check-in command with shutdown all subs
1 parent 79da246 commit 5b3681d

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

examples/common/pigweed/rpc_services/Device.h

+1
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ class Device : public pw_rpc::nanopb::Device::Service<Device>
485485
virtual pw::Status TriggerIcdCheckin(const pw_protobuf_Empty & request, pw_protobuf_Empty & response)
486486
{
487487
#if CHIP_CONFIG_ENABLE_ICD_CIP
488+
chip::app::InteractionModelEngine::GetInstance()->ShutdownAllSubscriptionHandlers();
488489
chip::DeviceLayer::PlatformMgr().ScheduleWork(
489490
[](intptr_t) {
490491
ChipLogDetail(AppServer, "Being triggerred to send ICD check-in message to subscriber");

src/app/InteractionModelEngine.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,18 @@ void InteractionModelEngine::ShutdownAllSubscriptions()
387387
ShutdownMatchingSubscriptions();
388388
}
389389

390+
void InteractionModelEngine::ShutdownAllSubscriptionHandlers()
391+
{
392+
mReadHandlers.ForEachActiveObject([&](auto * handler) {
393+
if (!handler->IsType(ReadHandler::InteractionType::Subscribe))
394+
{
395+
return Loop::Continue;
396+
}
397+
handler->Close();
398+
return Loop::Continue;
399+
});
400+
}
401+
390402
void InteractionModelEngine::ShutdownMatchingSubscriptions(const Optional<FabricIndex> & aFabricIndex,
391403
const Optional<NodeId> & aPeerNodeId)
392404
{

src/app/InteractionModelEngine.h

+6
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler,
169169
* Tears down all active subscriptions.
170170
*/
171171
void ShutdownAllSubscriptions();
172+
173+
/**
174+
* Tears down all subscription handlers.
175+
*/
176+
void ShutdownAllSubscriptionHandlers();
177+
172178
#endif // CHIP_CONFIG_ENABLE_READ_CLIENT
173179

174180
uint32_t GetNumActiveReadHandlers() const;

0 commit comments

Comments
 (0)