@@ -594,26 +594,21 @@ CHIP_ERROR ExchangeContext::HandleMessage(uint32_t messageCounter, const Payload
594
594
// Set kFlagReceivedAtLeastOneMessage to true since we have received at least one new application level message
595
595
SetHasReceivedAtLeastOneMessage (true );
596
596
597
- // Don't send messages on to our delegate if our dispatch does not allow
598
- // those messages. Those messages should also not be treated as responses,
599
- // since if our delegate is expecting a response we will not notify it about
600
- // these messages.
601
- if (mDispatch .MessagePermitted (payloadHeader.GetProtocolID (), payloadHeader.GetMessageType ()))
597
+ if (IsResponseExpected ())
602
598
{
603
- if (IsResponseExpected ())
604
- {
605
- // Since we got the response, cancel the response timer.
606
- CancelResponseTimer ();
599
+ // Since we got the response, cancel the response timer.
600
+ CancelResponseTimer ();
607
601
608
- // If the context was expecting a response to a previously sent message, this message
609
- // is implicitly that response.
610
- SetResponseExpected (false );
611
- }
602
+ // If the context was expecting a response to a previously sent message, this message
603
+ // is implicitly that response.
604
+ SetResponseExpected (false );
605
+ }
612
606
613
- if (mDelegate != nullptr )
614
- {
615
- return mDelegate ->OnMessageReceived (this , payloadHeader, std::move (msgBuf));
616
- }
607
+ // Don't send messages on to our delegate if our dispatch does not allow
608
+ // those messages.
609
+ if (mDelegate != nullptr && mDispatch .MessagePermitted (payloadHeader.GetProtocolID (), payloadHeader.GetMessageType ()))
610
+ {
611
+ return mDelegate ->OnMessageReceived (this , payloadHeader, std::move (msgBuf));
617
612
}
618
613
619
614
DefaultOnMessageReceived (this , payloadHeader.GetProtocolID (), payloadHeader.GetMessageType (), messageCounter,
0 commit comments