Skip to content

Commit 2eb1ad2

Browse files
Apply suggestions from code review
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent dfcfe9f commit 2eb1ad2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/darwin/Framework/CHIP/MTRDevice.mm

+5-4
Original file line numberDiff line numberDiff line change
@@ -2344,19 +2344,20 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray<NSDictionary<NSSt
23442344
}
23452345
NSArray * expectedValue = _expectedValueCache[attributePath];
23462346

2347-
// Report the attribute if read attribute would get a value that is changing and no expected value exists.
2347+
// Report the attribute if a read would get a changed value. This happens
2348+
// when our cached value changes and no expected value exists.
23482349
if (readCacheValueChanged && !expectedValue) {
23492350
previousValue = _readCache[attributePath];
23502351
shouldReportAttribute = YES;
23512352
}
23522353

2353-
// Update the readCache with the attribute value.
2354+
// Now that we have grabbed previousValue, update the readCache with the attribute value.
23542355
_readCache[attributePath] = attributeDataValue;
23552356

23562357
if (!shouldReportAttribute) {
2357-
23582358
// If an expected value exists, the attribute will not be reported at this time.
2359-
// When the expected value interval expires, the correct value will be reported.
2359+
// When the expected value interval expires, the correct value will be reported,
2360+
// if needed.
23602361
if (expectedValue) {
23612362
MTR_LOG_INFO("%@ report %@ value filtered - expected value still present", self, attributePath);
23622363
} else

0 commit comments

Comments
 (0)