Skip to content

Commit

Permalink
Add Ack check in group msg
Browse files Browse the repository at this point in the history
  • Loading branch information
jepenven-silabs committed Nov 5, 2021
1 parent 3f67119 commit 4861d45
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/transport/SessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,21 +486,25 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & packetHeade
ExitNow(err = CHIP_NO_ERROR);
}

// Group Messages should never send an Ack
if (payloadHeader.NeedsAck())
{
ChipLogError(Inet, "Invalid condition found in protocol header");
ExitNow(err = CHIP_ERROR_INCORRECT_STATE);
}

// TODO: Handle Group message counter here spec 4.7.3
// spec 4.5.1.2 for msg counter

if (isDuplicate == SessionManagerDelegate::DuplicateMessage::Yes && !payloadHeader.NeedsAck())
if (isDuplicate == SessionManagerDelegate::DuplicateMessage::Yes)
{
ChipLogDetail(Inet,
"Received a duplicate message with MessageCounter:" ChipLogFormatMessageCounter
" on exchange " ChipLogFormatExchangeId,
packetHeader.GetMessageCounter(), ChipLogValueExchangeIdFromReceivedHeader(payloadHeader));
if (!payloadHeader.NeedsAck())
{
// If it's a duplicate message, but doesn't require an ack, let's drop it right here to save CPU
// cycles on further message processing.
ExitNow(err = CHIP_NO_ERROR);
}

// If it's a duplicate message, let's drop it right here to save CPU cycles
ExitNow(err = CHIP_NO_ERROR);
}

// TODO: Commit Group Message Counter
Expand Down

0 comments on commit 4861d45

Please sign in to comment.