Skip to content

Commit

Permalink
Rename messageId into messageCounter (#9714)
Browse files Browse the repository at this point in the history
  • Loading branch information
kghost authored and pull[bot] committed Oct 5, 2021
1 parent c78cff8 commit 7c2e0a6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/lib/core/CHIPError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, CHIP_ERROR err)
case CHIP_ERROR_DUPLICATE_MESSAGE_RECEIVED.AsInteger():
desc = "Duplicate message received";
break;
case CHIP_ERROR_MESSAGE_ID_OUT_OF_WINDOW.AsInteger():
case CHIP_ERROR_MESSAGE_COUNTER_OUT_OF_WINDOW.AsInteger():
desc = "Message id out of window";
break;
}
Expand Down
8 changes: 4 additions & 4 deletions src/lib/core/CHIPError.h
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ using CHIP_ERROR = ::chip::ChipError;
* An acknowledgment id is invalid.
*
*/
#define CHIP_ERROR_INVALID_ACK_MESSAGE_COUNTER CHIP_CORE_ERROR(0x65)
#define CHIP_ERROR_INVALID_ACK_MESSAGE_COUNTER CHIP_CORE_ERROR(0x65)

/**
* @def CHIP_ERROR_SEND_THROTTLED
Expand Down Expand Up @@ -2171,15 +2171,15 @@ using CHIP_ERROR = ::chip::ChipError;
* @brief
* The fabric ID in ICA certificate doesn't match the one in NOC.
*/
#define CHIP_ERROR_FABRIC_MISMATCH_ON_ICA CHIP_CORE_ERROR(0xc6)
#define CHIP_ERROR_FABRIC_MISMATCH_ON_ICA CHIP_CORE_ERROR(0xc6)

/**
* @def CHIP_ERROR_MESSAGE_ID_OUT_OF_WINDOW
* @def CHIP_ERROR_MESSAGE_COUNTER_OUT_OF_WINDOW
*
* @brief
* The message counter of the received message is out of receiving window
*/
#define CHIP_ERROR_MESSAGE_ID_OUT_OF_WINDOW CHIP_CORE_ERROR(0xc7)
#define CHIP_ERROR_MESSAGE_COUNTER_OUT_OF_WINDOW CHIP_CORE_ERROR(0xc7)

/**
* @}
Expand Down
6 changes: 3 additions & 3 deletions src/messaging/ReliableMessageContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ uint64_t ReliableMessageContext::GetActiveRetransmitTimeoutTick()
* @note
* This message is part of the CHIP Reliable Messaging protocol.
*
* @param[in] ackMessageCounter The messageCounter of incoming Ack message.
* @param[in] ackMessageCounter The acknowledged message counter of the incoming message.
*
* @retval #CHIP_ERROR_INVALID_ACK_MESSAGE_COUNTER if the messageCounter of received Ack is not in the
* RetransTable.
* @retval #CHIP_ERROR_INVALID_ACK_MESSAGE_COUNTER if acknowledged message counter of received packet is not in the
* RetransTable.
* @retval #CHIP_NO_ERROR if the context was removed.
*
*/
Expand Down
7 changes: 3 additions & 4 deletions src/messaging/ReliableMessageMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,12 @@ class ReliableMessageMgr
* Iterate through active exchange contexts and retrans table entries. Clear the entry matching
* the specified ExchangeContext and the message ID from the retransmision table.
*
* @param[in] rc A pointer to the ExchangeContext object.
*
* @param[in] messageCounter message ID which has been acked.
* @param[in] rc A pointer to the ExchangeContext object.
* @param[in] ackMessageCounter The acknowledged message counter of the received packet.
*
* @retval #CHIP_NO_ERROR On success.
*/
bool CheckAndRemRetransTable(ReliableMessageContext * rc, uint32_t messageCounter);
bool CheckAndRemRetransTable(ReliableMessageContext * rc, uint32_t ackMessageCounter);

/**
* Send the specified entry from the retransmission table.
Expand Down
4 changes: 2 additions & 2 deletions src/transport/PeerMessageCounter.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class PeerMessageCounter
uint32_t offset = mSynced.mMaxCounter - counter;
if (offset >= CHIP_CONFIG_MESSAGE_COUNTER_WINDOW_SIZE)
{
return CHIP_ERROR_MESSAGE_ID_OUT_OF_WINDOW; // outside valid range
return CHIP_ERROR_MESSAGE_COUNTER_OUT_OF_WINDOW; // outside valid range
}
if (mSynced.mWindow.test(offset))
{
Expand All @@ -118,7 +118,7 @@ class PeerMessageCounter
return CHIP_NO_ERROR;
case Status::Synced: {
CHIP_ERROR err = Verify(counter);
if (err == CHIP_ERROR_MESSAGE_ID_OUT_OF_WINDOW)
if (err == CHIP_ERROR_MESSAGE_COUNTER_OUT_OF_WINDOW)
{
// According to chip spec, when global unencrypted message
// counter is out of window, the peer may have reset and is
Expand Down

0 comments on commit 7c2e0a6

Please sign in to comment.