Ensure Message::Clone() copies the message priority level (#1101)

This commit modifies the `Clone()` method so that it sets the same
priority level on the cloned/copied message as the original one.
This commit is contained in:
Abtin Keshavarzian
2016-12-22 15:18:21 -08:00
committed by Jonathan Hui
parent b06b2e06ae
commit 28c049f2ce
2 changed files with 6 additions and 2 deletions
+1
View File
@@ -662,6 +662,7 @@ Message *Message::Clone(uint16_t aLength) const
messageCopy->SetOffset(GetOffset());
messageCopy->SetInterfaceId(GetInterfaceId());
messageCopy->SetSubType(GetSubType());
messageCopy->SetPriority(GetPriority());
messageCopy->SetLinkSecurityEnabled(IsLinkSecurityEnabled());
exit:
+5 -2
View File
@@ -112,7 +112,7 @@ struct MessageInfo
uint8_t mSubType : 3; ///< Identifies the message sub type.
bool mDirectTx : 1; ///< Used to indicate whether a direct transmission is required.
bool mLinkSecurity : 1; ///< Indicates whether or not link security is enabled.
uint8_t mPriority: 2; ///< Identifies the message priority level (lower value is higher priority).
uint8_t mPriority : 2; ///< Identifies the message priority level (lower value is higher priority).
bool mInPriorityQ : 1; ///< Indicates whether the message is queued in normal or priority queue.
};
@@ -419,6 +419,9 @@ public:
* This method creates a copy of the current Message. It allocates the new one
* from the same Message Poll as the original Message and copies @p aLength octets of a payload.
*
* The `Type`, `SubType`, `LinkSecurity` and `Priority` fields on the cloned message are also
* copied from the original one.
*
* @param[in] aLength Number of payload bytes to copy.
*
* @returns A pointer to the message or NULL if insufficient message buffers are available.
@@ -986,7 +989,7 @@ public:
*
* @returns `true` if the iterator has ended , `false` otherwise.
*/
bool HasEnded(void) const { return IsEmpty();}
bool HasEnded(void) const { return IsEmpty(); }
/**
* This method returns a new iterator corresponding to next message on the list.