@@ -198,8 +198,6 @@ void InteractionModelEngine::Shutdown()
198
198
199
199
mTimedHandlers .ReleaseAll ();
200
200
201
- mReadHandlers .ReleaseAll ();
202
-
203
201
#if CHIP_CONFIG_ENABLE_READ_CLIENT
204
202
// Shut down any subscription clients that are still around. They won't be
205
203
// able to work after this point anyway, since we're about to drop our refs
@@ -220,6 +218,7 @@ void InteractionModelEngine::Shutdown()
220
218
readClient->mpImEngine = nullptr ;
221
219
auto * tmpClient = readClient->GetNextClient ();
222
220
readClient->SetNextClient (nullptr );
221
+ readClient->Close (CHIP_NO_ERROR);
223
222
readClient = tmpClient;
224
223
}
225
224
@@ -229,6 +228,7 @@ void InteractionModelEngine::Shutdown()
229
228
mpActiveReadClientList = nullptr ;
230
229
#endif // CHIP_CONFIG_ENABLE_READ_CLIENT
231
230
231
+ mReadHandlers .ReleaseAll ();
232
232
for (auto & writeHandler : mWriteHandlers )
233
233
{
234
234
if (!writeHandler.IsFree ())
@@ -1865,15 +1865,15 @@ Protocols::InteractionModel::Status InteractionModelEngine::CheckCommandExistenc
1865
1865
1866
1866
DataModel::Provider * InteractionModelEngine::SetDataModelProvider (DataModel::Provider * model)
1867
1867
{
1868
- // Altering data model should not be done while IM is actively handling requests.
1869
- VerifyOrDie (mReadHandlers .begin () == mReadHandlers .end ());
1870
-
1871
1868
if (model == mDataModelProvider )
1872
1869
{
1873
1870
// no-op, just return
1874
1871
return model;
1875
1872
}
1876
1873
1874
+ // Altering data model should not be done while IM is actively handling requests.
1875
+ VerifyOrDie (mReadHandlers .begin () == mReadHandlers .end ());
1876
+
1877
1877
DataModel::Provider * oldModel = mDataModelProvider ;
1878
1878
if (oldModel != nullptr )
1879
1879
{
0 commit comments