Skip to content

Commit fa4f4e9

Browse files
committed
Revert "Fix handling of non-permitted messages in ExchangeContext. (project-chip#33148) (project-chip#33290)"
This reverts commit 13ab158. Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
1 parent 372c69e commit fa4f4e9

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

src/messaging/ExchangeContext.cpp

+12-17
Original file line numberDiff line numberDiff line change
@@ -594,26 +594,21 @@ CHIP_ERROR ExchangeContext::HandleMessage(uint32_t messageCounter, const Payload
594594
// Set kFlagReceivedAtLeastOneMessage to true since we have received at least one new application level message
595595
SetHasReceivedAtLeastOneMessage(true);
596596

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())
602598
{
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();
607601

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+
}
612606

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));
617612
}
618613

619614
DefaultOnMessageReceived(this, payloadHeader.GetProtocolID(), payloadHeader.GetMessageType(), messageCounter,

0 commit comments

Comments
 (0)