Skip to content

Commit

Permalink
Don't reset ExchangeContext's "waiting to send" state when sending st…
Browse files Browse the repository at this point in the history
…andalone ack. (#8298)

This state is meant to track app-level sends, and standalone acks are
not app-level.
  • Loading branch information
bzbarsky-apple authored Jul 14, 2021
1 parent 51a49a9 commit f5d69c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/messaging/ExchangeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <core/CHIPCore.h>
#include <core/CHIPEncoding.h>
#include <core/CHIPKeyIds.h>
#include <lib/support/TypeTraits.h>
#include <messaging/ExchangeContext.h>
#include <messaging/ExchangeMgr.h>
#include <protocols/Protocols.h>
Expand Down Expand Up @@ -79,8 +80,13 @@ void ExchangeContext::SetResponseTimeout(Timeout timeout)
CHIP_ERROR ExchangeContext::SendMessage(Protocols::Id protocolId, uint8_t msgType, PacketBufferHandle && msgBuf,
const SendFlags & sendFlags)
{
// If we were waiting for a message send, this is it.
mFlags.Clear(Flags::kFlagWillSendMessage);
if (protocolId != Protocols::SecureChannel::Id || msgType != to_underlying(Protocols::SecureChannel::MsgType::StandaloneAck))
{
// If we were waiting for a message send, this is it. Standalone acks
// are not application-level sends, which is why we don't allow those to
// clear the WillSendMessage flag.
mFlags.Clear(Flags::kFlagWillSendMessage);
}

CHIP_ERROR err = CHIP_NO_ERROR;
Transport::PeerConnectionState * state = nullptr;
Expand Down
2 changes: 2 additions & 0 deletions src/protocols/Protocols.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class Id
return mVendorId == aOther.mVendorId && mProtocolId == aOther.mProtocolId;
}

constexpr bool operator!=(const Id & aOther) const { return !(*this == aOther); }

// Convert the Protocols::Id to a TLV profile id.
// NOTE: We may want to change the TLV reader/writer to take Protocols::Id
// directly later on and get rid of this method.
Expand Down

0 comments on commit f5d69c2

Please sign in to comment.