Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
nivi-apple committed Oct 2, 2023
1 parent 0dddcdb commit c015fac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
{
assertChipStackLockedByCurrentThread();

if (mExchangeMgr) {
mExchangeMgr->UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::BDX::Id);
mExchangeMgr = nullptr;
}
MTROTAUnsolicitedBDXMessageHandler::mNumberOfDelegates = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIPTests/MTROTAProviderTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

static const uint16_t kPairingTimeoutInSeconds = 10;
static const uint16_t kTimeoutInSeconds = 3;
static const uint16_t kTimeoutWithUpdateInSeconds = 60;
static const uint16_t kTimeoutWithUpdateInSeconds = 90;
static const uint64_t kDeviceId1 = 0x12341234;
static const uint64_t kDeviceId2 = 0x12341235;
static const uint64_t kDeviceId3 = 0x12341236;
Expand Down
55 changes: 21 additions & 34 deletions src/protocols/bdx/AsyncTransferFacilitator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ void AsyncTransferFacilitator::Reset()

CHIP_ERROR AsyncTransferFacilitator::SendMessage(TransferSession::OutputEvent & event)
{
assertChipStackLockedByCurrentThread();

VerifyOrReturnError(mExchange, CHIP_ERROR_INCORRECT_STATE);

Expand Down Expand Up @@ -68,6 +67,9 @@ CHIP_ERROR AsyncTransferFacilitator::SendMessage(TransferSession::OutputEvent &
CHIP_ERROR AsyncTransferFacilitator::OnMessageReceived(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader,
System::PacketBufferHandle && payload)
{

VerifyOrReturnError(mExchange, CHIP_ERROR_INCORRECT_STATE);

VerifyOrReturnError(ec == mExchange.Get(), CHIP_ERROR_INCORRECT_STATE);

CHIP_ERROR err =
Expand All @@ -94,12 +96,7 @@ CHIP_ERROR AsyncTransferFacilitator::OnMessageReceived(Messaging::ExchangeContex
// If its a message of type kMsgToSend, send the message over the exchange.
if (outEvent.EventType == TransferSession::OutputEventType::kMsgToSend)
{
err = SendMessage(outEvent);
if (err != CHIP_NO_ERROR)
{
// TODO: Should we abort transfer here or let the other side timeout
return err;
}
SendMessage(outEvent);
}
else
{
Expand Down Expand Up @@ -127,7 +124,7 @@ CHIP_ERROR AsyncTransferFacilitator::OnMessageReceived(Messaging::ExchangeContex
void AsyncTransferFacilitator::OnExchangeClosing(Messaging::ExchangeContext * ec)
{
ChipLogDetail(BDX, "OnExchangeClosing, ec: " ChipLogFormatExchange, ChipLogValueExchange(ec));
CleanUp();
mExchange.Release();
}

void AsyncTransferFacilitator::OnResponseTimeout(Messaging::ExchangeContext * ec)
Expand Down Expand Up @@ -175,36 +172,26 @@ void AsyncResponder::NotifyEventHandled(CHIP_ERROR eventHandlingResult)
// If there was an error, we abort the transfer.
if (eventHandlingResult != CHIP_NO_ERROR)
{
mTransfer.AbortTransfer(GetBdxStatusCodeFromChipError(eventHandlingResult));
}
CleanUp();
} else {

// We need to get the next output event from the state machine which is either a response to the
// BDX message handled by the subclass (ReceiveAccept/Block) or a status report or error or timeout
// event types.
TransferSession::OutputEvent outEvent;

mTransfer.GetNextAction(outEvent);
while (outEvent.EventType != TransferSession::OutputEventType::kNone)
{
if (outEvent.EventType == TransferSession::OutputEventType::kMsgToSend)
// We need to get the next output event from the state machine which is a response to the
// BDX message handled by the subclass (ReceiveAccept/Block).
TransferSession::OutputEvent outEvent;

mTransfer.GetNextAction(outEvent);
while (outEvent.EventType != TransferSession::OutputEventType::kNone)
{
CHIP_ERROR err = AsyncTransferFacilitator::SendMessage(outEvent);
if (err != CHIP_NO_ERROR)
if (outEvent.EventType == TransferSession::OutputEventType::kMsgToSend)
{
// TODO: Should we abort transfer here or let the other side timeout
return;
AsyncTransferFacilitator::SendMessage(outEvent);
mTransfer.GetNextAction(outEvent);
} else {
break;
}
}
else if (outEvent.EventType == TransferSession::OutputEventType::kInternalError ||
outEvent.EventType == TransferSession::OutputEventType::kTransferTimeout ||
outEvent.EventType == TransferSession::OutputEventType::kStatusReceived)
{
HandleTransferSessionOutput(outEvent);
CleanUp();
return;
}
mTransfer.GetNextAction(outEvent);
};

};
}
}

} // namespace bdx
Expand Down

0 comments on commit c015fac

Please sign in to comment.