Skip to content

Commit

Permalink
[Matter.framework] Enforce max reporting interval to kSubscriptionMax…
Browse files Browse the repository at this point in the history
…IntervalPublisherLimit
  • Loading branch information
vivien-apple authored and woody-apple committed Oct 18, 2024
1 parent 76e9e14 commit 0db0138
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ @interface MTRDeviceControllerFactoryParams ()

@end

class MTRApplicationCallback : public app::ReadHandler::ApplicationCallback {
CHIP_ERROR OnSubscriptionRequested(app::ReadHandler & readHandler, Transport::SecureSession & secureSession) override
{
return readHandler.SetMaxReportingInterval(kSubscriptionMaxIntervalPublisherLimit);
}
};

MTR_DIRECT_MEMBERS
@interface MTRDeviceControllerFactory ()
- (void)preWarmCommissioningSessionDone;
Expand All @@ -90,6 +97,7 @@ @implementation MTRDeviceControllerFactory {

Credentials::IgnoreCertificateValidityPeriodPolicy _certificateValidityPolicy;
Crypto::RawKeySessionKeystore _sessionKeystore;
MTRApplicationCallback _applicationCallback;
// We use TestPersistentStorageDelegate just to get an in-memory store to back
// our group data provider impl. We initialize this store correctly on every
// controller startup, so don't need to actually persist it.
Expand Down Expand Up @@ -239,6 +247,8 @@ - (void)cleanupStartupObjects

// Make sure the deinit order here is the reverse of the init order in
// startControllerFactory:
app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback();

_certificationDeclarationCertificates = nil;
_productAttestationAuthorityCertificates = nil;

Expand Down Expand Up @@ -366,6 +376,8 @@ - (BOOL)_startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParam
_productAttestationAuthorityCertificates = [startupParams.productAttestationAuthorityCertificates copy];
_certificationDeclarationCertificates = [startupParams.certificationDeclarationCertificates copy];

app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(&_applicationCallback);

{
chip::Controller::FactoryInitParams params;
if (startupParams.port != nil) {
Expand Down

0 comments on commit 0db0138

Please sign in to comment.