Skip to content

Commit

Permalink
Fix MTRDevice tests for diagnostic logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nivi-apple committed Nov 7, 2023
1 parent 7294b5a commit e0fc837
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <app/CommandHandlerInterface.h>
#include <app/ConcreteCommandPath.h>
#include <app/InteractionModelEngine.h>
#include <app/util/config.h>
#include <lib/support/ScopedBuffer.h>
#include <messaging/ExchangeContext.h>

Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/MTRDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ - (void)_downloadLogOfType:(MTRDiagnosticLogType)type
[self _invokeCompletionWithError:completion queue:queue error:[NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeInvalidState userInfo:nil]];
}

if (self->_diagnosticLogsTransferHandler != nullptr && self->_diagnosticLogsTransferHandler->IsInBDXSession()) {
if (self->_diagnosticLogsTransferHandler != nil && self->_diagnosticLogsTransferHandler->IsInBDXSession()) {
[self _invokeCompletionWithError:completion queue:queue error:[NSError errorWithDomain:MTRInteractionErrorDomain code:MTRInteractionErrorCodeBusy userInfo:nil]];
}

Expand Down Expand Up @@ -1471,7 +1471,7 @@ - (void)_downloadLogOfType:(MTRDiagnosticLogType)type
[cluster retrieveLogsRequestWithParams:requestParams expectedValues:nil expectedValueInterval:nil
completion:^(MTRDiagnosticLogsClusterRetrieveLogsResponseParams * _Nullable response, NSError * _Nullable error) {
// If we are in a BDX session and there is no error, do nothing. Completion will be called when BDX succeeds or fails.
if (self->_diagnosticLogsTransferHandler->IsInBDXSession() && error == nil) {
if (self->_diagnosticLogsTransferHandler != nil && self->_diagnosticLogsTransferHandler->IsInBDXSession() && error == nil) {
return;
}

Expand Down
2 changes: 0 additions & 2 deletions src/protocols/bdx/TransferFacilitator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ CHIP_ERROR Responder::PrepareForTransfer(System::Layer * layer, TransferRole rol
void Responder::ResetTransfer()
{
mTransfer.Reset();
mSystemLayer = nullptr;
ChipLogProgress(BDX, "Stop polling for messages");
mStopPolling = true;
}
Expand All @@ -136,7 +135,6 @@ CHIP_ERROR Initiator::InitiateTransfer(System::Layer * layer, TransferRole role,
void Initiator::ResetTransfer()
{
mTransfer.Reset();
mSystemLayer = nullptr;
ChipLogProgress(BDX, "Stop polling for messages");
mStopPolling = true;
}
Expand Down

0 comments on commit e0fc837

Please sign in to comment.