Skip to content

Commit

Permalink
ICD: fix expect response count issue (#28887)
Browse files Browse the repository at this point in the history
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
  • Loading branch information
2 people authored and pull[bot] committed Jan 9, 2024
1 parent 744d619 commit 1094340
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/messaging/ExchangeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ CHIP_ERROR ExchangeContext::SendMessage(Protocols::Id protocolId, uint8_t msgTyp
bool reliableTransmissionRequested =
GetSessionHandle()->RequireMRP() && !sendFlags.Has(SendMessageFlags::kNoAutoRequestAck) && !IsGroupExchangeContext();

bool startedResponseTimer = false;
bool currentMessageExpectResponse = false;
// If a response message is expected...
if (sendFlags.Has(SendMessageFlags::kExpectResponse) && !IsGroupExchangeContext())
{
Expand All @@ -178,7 +178,7 @@ CHIP_ERROR ExchangeContext::SendMessage(Protocols::Id protocolId, uint8_t msgTyp
SetResponseExpected(false);
return err;
}
startedResponseTimer = true;
currentMessageExpectResponse = true;
}
}

Expand Down Expand Up @@ -222,9 +222,9 @@ CHIP_ERROR ExchangeContext::SendMessage(Protocols::Id protocolId, uint8_t msgTyp
#endif
if (err != CHIP_NO_ERROR)
{
// We should only cancel the response timer if the ExchangeContext fails to send the message that starts the response
// timer.
if (startedResponseTimer)
// We should only cancel the response timer if the ExchangeContext fails to send the message that expects a
// response.
if (currentMessageExpectResponse)
{
CancelResponseTimer();
SetResponseExpected(false);
Expand All @@ -243,7 +243,7 @@ CHIP_ERROR ExchangeContext::SendMessage(Protocols::Id protocolId, uint8_t msgTyp
#if CONFIG_DEVICE_LAYER && CHIP_CONFIG_ENABLE_ICD_SERVER
DeviceLayer::ChipDeviceEvent event;
event.Type = DeviceLayer::DeviceEventType::kChipMsgSentEvent;
event.MessageSent.ExpectResponse = IsResponseExpected();
event.MessageSent.ExpectResponse = currentMessageExpectResponse;
CHIP_ERROR status = DeviceLayer::PlatformMgr().PostEvent(&event);
if (status != CHIP_NO_ERROR)
{
Expand Down

0 comments on commit 1094340

Please # to comment.