File tree 5 files changed +50
-3
lines changed
5 files changed +50
-3
lines changed Original file line number Diff line number Diff line change @@ -403,6 +403,9 @@ void DeviceController::Shutdown()
403
403
// assume that all sessions for our fabric belong to us here.
404
404
mSystemState ->CASESessionMgr ()->ReleaseSessionsForFabric (mFabricIndex );
405
405
406
+ // Shut down any bdx transfers we're acting as the server for.
407
+ mSystemState ->BDXTransferServer ()->AbortTransfersForFabric (mFabricIndex );
408
+
406
409
// TODO: The CASE session manager does not shut down existing CASE
407
410
// sessions. It just shuts down any ongoing CASE session establishment
408
411
// we're in the middle of as initiator. Maybe it should shut down
Original file line number Diff line number Diff line change 18
18
19
19
#include " BdxTransferDiagnosticLog.h"
20
20
21
+ #include < protocols/bdx/BdxTransferDiagnosticLogPool.h>
22
+
21
23
namespace chip {
22
24
namespace bdx {
23
25
@@ -201,5 +203,23 @@ void BdxTransferDiagnosticLog::OnExchangeClosing(Messaging::ExchangeContext * ec
201
203
LogErrorOnFailure (OnTransferSessionEnd (CHIP_ERROR_INTERNAL));
202
204
}
203
205
206
+ bool BdxTransferDiagnosticLog::IsForFabric (FabricIndex fabricIndex) const
207
+ {
208
+ if (mExchangeCtx == nullptr || !mExchangeCtx ->HasSessionHandle ())
209
+ {
210
+ return false ;
211
+ }
212
+
213
+ auto session = mExchangeCtx ->GetSessionHandle ();
214
+ return session->GetFabricIndex () == fabricIndex;
215
+ }
216
+
217
+ void BdxTransferDiagnosticLog::AbortTransfer ()
218
+ {
219
+ // No need to mTransfer.AbortTransfer() here, since that just tries to async
220
+ // send a StatusReport to the other side, but we are going away here.
221
+ Reset ();
222
+ }
223
+
204
224
} // namespace bdx
205
225
} // namespace chip
Original file line number Diff line number Diff line change 18
18
19
19
#pragma once
20
20
21
- #include < protocols/bdx/BdxTransferDiagnosticLogPool .h>
21
+ #include < lib/core/DataModelTypes .h>
22
22
#include < protocols/bdx/BdxTransferProxyDiagnosticLog.h>
23
+ #include < protocols/bdx/BdxTransferServerDelegate.h>
23
24
#include < protocols/bdx/TransferFacilitator.h>
24
25
#include < system/SystemLayer.h>
25
26
26
27
namespace chip {
27
28
namespace bdx {
28
29
30
+ class BdxTransferDiagnosticLogPoolDelegate ;
31
+
29
32
class BdxTransferDiagnosticLog : public Responder
30
33
{
31
34
public:
@@ -45,6 +48,13 @@ class BdxTransferDiagnosticLog : public Responder
45
48
46
49
void OnExchangeClosing (Messaging::ExchangeContext * ec) override ;
47
50
51
+ /* *
52
+ * Lifetime management, to allow us to abort transfers when a fabric
53
+ * identity is being shut down.
54
+ */
55
+ bool IsForFabric (FabricIndex fabricIndex) const ;
56
+ void AbortTransfer ();
57
+
48
58
protected:
49
59
/* *
50
60
* Called when a BDX message is received over the exchange context
Original file line number Diff line number Diff line change 18
18
19
19
#pragma once
20
20
21
+ #include < lib/core/DataModelTypes.h>
21
22
#include < lib/support/Pool.h>
23
+ #include < protocols/bdx/BdxTransferDiagnosticLog.h>
22
24
#include < protocols/bdx/BdxTransferServerDelegate.h>
23
25
#include < system/SystemLayer.h>
24
26
25
27
namespace chip {
26
28
namespace bdx {
27
29
28
- class BdxTransferDiagnosticLog ;
29
-
30
30
class BdxTransferDiagnosticLogPoolDelegate
31
31
{
32
32
public:
@@ -50,6 +50,17 @@ class BdxTransferDiagnosticLogPool : public BdxTransferDiagnosticLogPoolDelegate
50
50
51
51
void Release (BdxTransferDiagnosticLog * transfer) override { mTransferPool .ReleaseObject (transfer); }
52
52
53
+ void AbortTransfersForFabric (FabricIndex fabricIndex)
54
+ {
55
+ mTransferPool .ForEachActiveObject ([fabricIndex](BdxTransferDiagnosticLog * transfer) {
56
+ if (transfer->IsForFabric (fabricIndex))
57
+ {
58
+ transfer->AbortTransfer ();
59
+ }
60
+ return Loop::Continue;
61
+ });
62
+ }
63
+
53
64
private:
54
65
ObjectPool<BdxTransferDiagnosticLog, N> mTransferPool ;
55
66
};
Original file line number Diff line number Diff line change 20
20
21
21
#include < protocols/bdx/BdxTransferDiagnosticLogPool.h>
22
22
23
+ #include < lib/core/DataModelTypes.h>
23
24
#include < messaging/ExchangeDelegate.h>
24
25
#include < messaging/ExchangeMgr.h>
25
26
#include < protocols/bdx/BdxTransferDiagnosticLog.h>
@@ -42,6 +43,8 @@ class BDXTransferServer : public Messaging::UnsolicitedMessageHandler
42
43
43
44
void SetDelegate (BDXTransferServerDelegate * delegate) { mDelegate = delegate; }
44
45
46
+ void AbortTransfersForFabric (FabricIndex fabricIndex) { mPoolDelegate .AbortTransfersForFabric (fabricIndex); }
47
+
45
48
protected:
46
49
CHIP_ERROR OnUnsolicitedMessageReceived (const PayloadHeader & payloadHeader,
47
50
Messaging::ExchangeDelegate *& newDelegate) override ;
You can’t perform that action at this time.
0 commit comments