-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename messageId into messageCounter #9688
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ namespace chip { | |
namespace Messaging { | ||
|
||
ReliableMessageContext::ReliableMessageContext() : | ||
mConfig(gDefaultReliableMessageProtocolConfig), mNextAckTimeTick(0), mPendingPeerAckId(0) | ||
mConfig(gDefaultReliableMessageProtocolConfig), mNextAckTimeTick(0), mPendingPeerAckMessageCounter(0) | ||
{} | ||
|
||
void ReliableMessageContext::RetainContext() | ||
|
@@ -125,7 +125,7 @@ CHIP_ERROR ReliableMessageContext::FlushAcks() | |
if (err == CHIP_NO_ERROR) | ||
{ | ||
#if !defined(NDEBUG) | ||
ChipLogDetail(ExchangeManager, "Flushed pending ack for MsgId:%08" PRIX32, mPendingPeerAckId); | ||
ChipLogDetail(ExchangeManager, "Flushed pending ack for MessageCounter:%08" PRIX32, mPendingPeerAckMessageCounter); | ||
#endif | ||
} | ||
} | ||
|
@@ -150,36 +150,37 @@ uint64_t ReliableMessageContext::GetActiveRetransmitTimeoutTick() | |
* @note | ||
* This message is part of the CHIP Reliable Messaging protocol. | ||
* | ||
* @param[in] AckMsgId The msgId of incoming Ack message. | ||
* @param[in] ackMessageCounter The messageCounter of incoming Ack message. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the "Acknowledged Message Counter" of the incoming message, not the "Message Counter", right? Pre-existing; please either do a followup to fix this documentation to be less confusing or let me know when this merges and I will. |
||
* | ||
* @retval #CHIP_ERROR_INVALID_ACK_ID if the msgId of received Ack is not in the RetransTable. | ||
* @retval #CHIP_ERROR_INVALID_ACK_MESSAGE_COUNTER if the messageCounter of received Ack is not in the | ||
* RetransTable. | ||
* @retval #CHIP_NO_ERROR if the context was removed. | ||
* | ||
*/ | ||
CHIP_ERROR ReliableMessageContext::HandleRcvdAck(uint32_t AckMsgId) | ||
CHIP_ERROR ReliableMessageContext::HandleRcvdAck(uint32_t ackMessageCounter) | ||
{ | ||
CHIP_ERROR err = CHIP_NO_ERROR; | ||
|
||
// Msg is an Ack; Check Retrans Table and remove message context | ||
if (!GetReliableMessageMgr()->CheckAndRemRetransTable(this, AckMsgId)) | ||
if (!GetReliableMessageMgr()->CheckAndRemRetransTable(this, ackMessageCounter)) | ||
{ | ||
#if !defined(NDEBUG) | ||
ChipLogError(ExchangeManager, "CHIP MsgId:%08" PRIX32 " not in RetransTable", AckMsgId); | ||
ChipLogError(ExchangeManager, "CHIP MessageCounter:%08" PRIX32 " not in RetransTable", ackMessageCounter); | ||
#endif | ||
err = CHIP_ERROR_INVALID_ACK_ID; | ||
err = CHIP_ERROR_INVALID_ACK_MESSAGE_COUNTER; | ||
// Optionally call an application callback with this error. | ||
} | ||
else | ||
{ | ||
#if !defined(NDEBUG) | ||
ChipLogDetail(ExchangeManager, "Removed CHIP MsgId:%08" PRIX32 " from RetransTable", AckMsgId); | ||
ChipLogDetail(ExchangeManager, "Removed CHIP MessageCounter:%08" PRIX32 " from RetransTable", ackMessageCounter); | ||
#endif | ||
} | ||
|
||
return err; | ||
} | ||
|
||
CHIP_ERROR ReliableMessageContext::HandleNeedsAck(uint32_t messageId, BitFlags<MessageFlagValues> messageFlags) | ||
CHIP_ERROR ReliableMessageContext::HandleNeedsAck(uint32_t messageCounter, BitFlags<MessageFlagValues> messageFlags) | ||
|
||
{ | ||
// Skip processing ack if drop ack debug is enabled. | ||
|
@@ -189,41 +190,41 @@ CHIP_ERROR ReliableMessageContext::HandleNeedsAck(uint32_t messageId, BitFlags<M | |
// Expire any virtual ticks that have expired so all wakeup sources reflect the current time | ||
GetReliableMessageMgr()->ExpireTicks(); | ||
|
||
CHIP_ERROR err = HandleNeedsAckInner(messageId, messageFlags); | ||
CHIP_ERROR err = HandleNeedsAckInner(messageCounter, messageFlags); | ||
|
||
// Schedule next physical wakeup on function exit | ||
GetReliableMessageMgr()->StartTimer(); | ||
|
||
return err; | ||
} | ||
|
||
CHIP_ERROR ReliableMessageContext::HandleNeedsAckInner(uint32_t messageId, BitFlags<MessageFlagValues> messageFlags) | ||
CHIP_ERROR ReliableMessageContext::HandleNeedsAckInner(uint32_t messageCounter, BitFlags<MessageFlagValues> messageFlags) | ||
|
||
{ | ||
// If the message IS a duplicate there will never be a response to it, so we | ||
// should not wait for one and just immediately send a standalone ack. | ||
if (messageFlags.Has(MessageFlagValues::kDuplicateMessage)) | ||
{ | ||
#if !defined(NDEBUG) | ||
ChipLogDetail(ExchangeManager, "Forcing tx of solitary ack for duplicate MsgId:%08" PRIX32, messageId); | ||
ChipLogDetail(ExchangeManager, "Forcing tx of solitary ack for duplicate MessageCounter:%08" PRIX32, messageCounter); | ||
#endif | ||
// Is there pending ack for a different message id. | ||
bool wasAckPending = IsAckPending() && mPendingPeerAckId != messageId; | ||
// Is there pending ack for a different message counter. | ||
bool wasAckPending = IsAckPending() && mPendingPeerAckMessageCounter != messageCounter; | ||
|
||
// Temporary store currently pending ack id (even if there is none). | ||
uint32_t tempAckId = mPendingPeerAckId; | ||
// Temporary store currently pending ack message counter (even if there is none). | ||
uint32_t tempAckMessageCounter = mPendingPeerAckMessageCounter; | ||
|
||
// Set the pending ack id. | ||
SetPendingPeerAckId(messageId); | ||
// Set the pending ack message counter. | ||
SetPendingPeerAckMessageCounter(messageCounter); | ||
|
||
// Send the Ack for the duplication message in a SecureChannel::StandaloneAck message. | ||
CHIP_ERROR err = SendStandaloneAckMessage(); | ||
|
||
// If there was pending ack for a different message id. | ||
// If there was pending ack for a different message counter. | ||
if (wasAckPending) | ||
{ | ||
// Restore previously pending ack id. | ||
SetPendingPeerAckId(tempAckId); | ||
// Restore previously pending ack message counter. | ||
SetPendingPeerAckMessageCounter(tempAckMessageCounter); | ||
} | ||
|
||
return err; | ||
|
@@ -234,15 +235,15 @@ CHIP_ERROR ReliableMessageContext::HandleNeedsAckInner(uint32_t messageId, BitFl | |
if (IsAckPending()) | ||
{ | ||
#if !defined(NDEBUG) | ||
ChipLogDetail(ExchangeManager, "Pending ack queue full; forcing tx of solitary ack for MsgId:%08" PRIX32, | ||
mPendingPeerAckId); | ||
ChipLogDetail(ExchangeManager, "Pending ack queue full; forcing tx of solitary ack for MessageCounter:%08" PRIX32, | ||
mPendingPeerAckMessageCounter); | ||
#endif | ||
// Send the Ack for the currently pending Ack in a SecureChannel::StandaloneAck message. | ||
ReturnErrorOnFailure(SendStandaloneAckMessage()); | ||
} | ||
|
||
// Replace the Pending ack id. | ||
SetPendingPeerAckId(messageId); | ||
// Replace the Pending ack message counter. | ||
SetPendingPeerAckMessageCounter(messageCounter); | ||
mNextAckTimeTick = | ||
static_cast<uint16_t>(CHIP_CONFIG_RMP_DEFAULT_ACK_TIMEOUT_TICK + | ||
GetReliableMessageMgr()->GetTickCounterFromTimeDelta(System::Clock::GetMonotonicMilliseconds())); | ||
|
@@ -261,7 +262,7 @@ CHIP_ERROR ReliableMessageContext::SendStandaloneAckMessage() | |
|
||
// Send the null message | ||
#if !defined(NDEBUG) | ||
ChipLogDetail(ExchangeManager, "Sending Standalone Ack for MsgId:%08" PRIX32, mPendingPeerAckId); | ||
ChipLogDetail(ExchangeManager, "Sending Standalone Ack for MessageCounter:%08" PRIX32, mPendingPeerAckMessageCounter); | ||
#endif | ||
|
||
CHIP_ERROR err = GetExchangeContext()->SendMessage(Protocols::SecureChannel::MsgType::StandaloneAck, std::move(msgBuf), | ||
|
@@ -273,16 +274,16 @@ CHIP_ERROR ReliableMessageContext::SendStandaloneAckMessage() | |
} | ||
if (err != CHIP_NO_ERROR) | ||
{ | ||
ChipLogError(ExchangeManager, "Failed to send Solitary ack for MsgId:%08" PRIX32 ":%" CHIP_ERROR_FORMAT, mPendingPeerAckId, | ||
err.Format()); | ||
ChipLogError(ExchangeManager, "Failed to send Solitary ack for MessageCounter:%08" PRIX32 ":%" CHIP_ERROR_FORMAT, | ||
mPendingPeerAckMessageCounter, err.Format()); | ||
} | ||
|
||
return err; | ||
} | ||
|
||
void ReliableMessageContext::SetPendingPeerAckId(uint32_t aPeerAckId) | ||
void ReliableMessageContext::SetPendingPeerAckMessageCounter(uint32_t aPeerAckMessageCounter) | ||
{ | ||
mPendingPeerAckId = aPeerAckId; | ||
mPendingPeerAckMessageCounter = aPeerAckMessageCounter; | ||
SetAckPending(true); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followup: Should change the name of this error too?