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 493d36f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 38 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
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 493d36f

Please sign in to comment.