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 <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Nov 17, 2023
1 parent 05435d1 commit 4654daf
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 4654daf

Please sign in to comment.