Skip to content

Commit

Permalink
ExchangeContext remove unused flags (#17731)
Browse files Browse the repository at this point in the history
* ExchangeContext remove unused flags

* Update src/messaging/ReliableMessageContext.h

Co-authored-by: Boris Zbarsky <[email protected]>

* Resolve comments: do not rename HasPiggybackAckPending

* Update comments

Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Sep 22, 2023
1 parent 1b85307 commit 1037742
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 51 deletions.
1 change: 0 additions & 1 deletion src/messaging/ExchangeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ ExchangeContext::ExchangeContext(ExchangeManager * em, uint16_t ExchangeId, cons
mFlags.Set(Flags::kFlagInitiator, Initiator);
mDelegate = delegate;

SetDropAckDebug(false);
SetAckPending(false);

// Do not request Ack for multicast
Expand Down
4 changes: 0 additions & 4 deletions src/messaging/ReliableMessageContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ void ReliableMessageContext::HandleRcvdAck(uint32_t ackMessageCounter)
CHIP_ERROR ReliableMessageContext::HandleNeedsAck(uint32_t messageCounter, BitFlags<MessageFlagValues> messageFlags)

{
// Skip processing ack if drop ack debug is enabled.
if (ShouldDropAckDebug())
return CHIP_NO_ERROR;

CHIP_ERROR err = HandleNeedsAckInner(messageCounter, messageFlags);

// Schedule next physical wakeup on function exit
Expand Down
58 changes: 12 additions & 46 deletions src/messaging/ReliableMessageContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class ReliableMessageContext
}

/**
* Check whether we have an ack to piggyback on the message we are sending.
* If true, TakePendingPeerAckMessageCounter will return a valid value that
* should be included as an ack in the message.
* Check whether we have a mPendingPeerAckMessageCounter. The counter is
* valid once we receive a message which requests an ack. Once
* mPendingPeerAckMessageCounter is valid, it never stops being valid.
*/
bool HasPiggybackAckPending() const;

Expand Down Expand Up @@ -102,26 +102,6 @@ class ReliableMessageContext
*/
void SetAutoRequestAck(bool autoReqAck);

/**
* Determine whether the ChipExchangeManager should not send an
* acknowledgement.
*
* For internal, debug use only.
*/
bool ShouldDropAckDebug() const;

/**
* Set whether the ChipExchangeManager should not send acknowledgements
* for this context.
*
* For internal, debug use only.
*
* @param[in] inDropAckDebug A Boolean indicating whether (true) or not
* (false) the acknowledgements should be not
* sent for the exchange.
*/
void SetDropAckDebug(bool inDropAckDebug);

/**
* Determine whether there is already an acknowledgment pending to be sent to the peer on this exchange.
*
Expand Down Expand Up @@ -159,29 +139,25 @@ class ReliableMessageContext
/// When set, automatically request an acknowledgment whenever a message is sent via UDP.
kFlagAutoRequestAck = (1u << 2),

/// Internal and debug only: when set, the exchange layer does not send an acknowledgment.
kFlagDropAckDebug = (1u << 3),

/// When set, signifies there is a message which hasn't been acknowledged.
kFlagMessageNotAcked = (1u << 4),
kFlagMessageNotAcked = (1u << 3),

/// When set, signifies that there is an acknowledgment pending to be sent back.
kFlagAckPending = (1u << 5),
kFlagAckPending = (1u << 4),

/// When set, signifies that there has once been an acknowledgment
/// pending to be sent back. In that case,
/// mPendingPeerAckMessageCounter is a valid message counter value for
/// some message we have needed to acknowledge in the past.
kFlagAckMessageCounterIsValid = (1u << 6),
/// When set, signifies that mPendingPeerAckMessageCounter is valid.
/// The counter is valid once we receive a message which requests an ack.
/// Once mPendingPeerAckMessageCounter is valid, it never stops being valid.
kFlagAckMessageCounterIsValid = (1u << 5),

/// When set, signifies that this exchange is waiting for a call to SendMessage.
kFlagWillSendMessage = (1u << 7),
kFlagWillSendMessage = (1u << 6),

/// When set, we have had Close() or Abort() called on us already.
kFlagClosed = (1u << 8),
kFlagClosed = (1u << 7),

/// When set, signifies that the exchange is requesting Sleepy End Device active mode.
kFlagActiveMode = (1u << 9),
kFlagActiveMode = (1u << 8),
};

BitFlags<Flags> mFlags; // Internal state flags
Expand Down Expand Up @@ -228,11 +204,6 @@ inline bool ReliableMessageContext::IsMessageNotAcked() const
return mFlags.Has(Flags::kFlagMessageNotAcked);
}

inline bool ReliableMessageContext::ShouldDropAckDebug() const
{
return mFlags.Has(Flags::kFlagDropAckDebug);
}

inline bool ReliableMessageContext::HasPiggybackAckPending() const
{
return mFlags.Has(Flags::kFlagAckMessageCounterIsValid);
Expand All @@ -253,11 +224,6 @@ inline void ReliableMessageContext::SetAckPending(bool inAckPending)
mFlags.Set(Flags::kFlagAckPending, inAckPending);
}

inline void ReliableMessageContext::SetDropAckDebug(bool inDropAckDebug)
{
mFlags.Set(Flags::kFlagDropAckDebug, inDropAckDebug);
}

inline void ReliableMessageContext::SetMessageNotAcked(bool messageNotAcked)
{
mFlags.Set(Flags::kFlagMessageNotAcked, messageNotAcked);
Expand Down

0 comments on commit 1037742

Please sign in to comment.