@@ -36,6 +36,56 @@ void CASESessionManager::FindOrEstablishSession(const ScopedNodeId & peerId, Cal
36
36
uint8_t attemptCount, Callback::Callback<OnDeviceConnectionRetry> * onRetry
37
37
#endif // CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
38
38
)
39
+ {
40
+ FindOrEstablishSessionHelper (peerId, onConnection, onFailure, nullptr
41
+ #if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
42
+ ,
43
+ attemptCount, onRetry
44
+ #endif
45
+ );
46
+ }
47
+
48
+ void CASESessionManager::FindOrEstablishSession (const ScopedNodeId & peerId, Callback::Callback<OnDeviceConnected> * onConnection,
49
+ Callback::Callback<OperationalSessionSetup::OnSetupFailure> * onSetupFailure
50
+ #if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
51
+ ,
52
+ uint8_t attemptCount, Callback::Callback<OnDeviceConnectionRetry> * onRetry
53
+ #endif
54
+ )
55
+ {
56
+ FindOrEstablishSessionHelper (peerId, onConnection, nullptr , onSetupFailure
57
+ #if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
58
+ ,
59
+ attemptCount, onRetry
60
+ #endif
61
+ );
62
+ }
63
+
64
+ void CASESessionManager::FindOrEstablishSession (const ScopedNodeId & peerId, Callback::Callback<OnDeviceConnected> * onConnection,
65
+ nullptr_t
66
+ #if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
67
+ ,
68
+ uint8_t attemptCount, Callback::Callback<OnDeviceConnectionRetry> * onRetry
69
+ #endif
70
+ )
71
+ {
72
+ FindOrEstablishSessionHelper (peerId, onConnection, nullptr , nullptr
73
+ #if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
74
+ ,
75
+ attemptCount, onRetry
76
+ #endif
77
+ );
78
+ }
79
+
80
+ void CASESessionManager::FindOrEstablishSessionHelper (const ScopedNodeId & peerId,
81
+ Callback::Callback<OnDeviceConnected> * onConnection,
82
+ Callback::Callback<OnDeviceConnectionFailure> * onFailure,
83
+ Callback::Callback<OperationalSessionSetup::OnSetupFailure> * onSetupFailure
84
+ #if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
85
+ ,
86
+ uint8_t attemptCount, Callback::Callback<OnDeviceConnectionRetry> * onRetry
87
+ #endif
88
+ )
39
89
{
40
90
ChipLogDetail (CASESessionManager, " FindOrEstablishSession: PeerId = [%d:" ChipLogFormatX64 " ]" , peerId.GetFabricIndex (),
41
91
ChipLogValueX64 (peerId.GetNodeId ()));
@@ -45,7 +95,6 @@ void CASESessionManager::FindOrEstablishSession(const ScopedNodeId & peerId, Cal
45
95
if (session == nullptr )
46
96
{
47
97
ChipLogDetail (CASESessionManager, " FindOrEstablishSession: No existing OperationalSessionSetup instance found" );
48
-
49
98
session = mConfig .sessionSetupPool ->Allocate (mConfig .sessionInitParams , mConfig .clientPool , peerId, this );
50
99
51
100
if (session == nullptr )
@@ -54,6 +103,13 @@ void CASESessionManager::FindOrEstablishSession(const ScopedNodeId & peerId, Cal
54
103
{
55
104
onFailure->mCall (onFailure->mContext , peerId, CHIP_ERROR_NO_MEMORY);
56
105
}
106
+
107
+ if (onSetupFailure != nullptr )
108
+ {
109
+ OperationalSessionSetup::ConnnectionFailureInfo failureInfo (peerId, CHIP_ERROR_NO_MEMORY,
110
+ SessionEstablishmentStage::kUnknown );
111
+ onSetupFailure->mCall (onSetupFailure->mContext , failureInfo);
112
+ }
57
113
return ;
58
114
}
59
115
}
@@ -66,7 +122,15 @@ void CASESessionManager::FindOrEstablishSession(const ScopedNodeId & peerId, Cal
66
122
}
67
123
#endif // CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
68
124
69
- session->Connect (onConnection, onFailure);
125
+ if (onFailure != nullptr )
126
+ {
127
+ session->Connect (onConnection, onFailure);
128
+ }
129
+
130
+ if (onSetupFailure != nullptr )
131
+ {
132
+ session->Connect (onConnection, onSetupFailure);
133
+ }
70
134
}
71
135
72
136
void CASESessionManager::ReleaseSessionsForFabric (FabricIndex fabricIndex)
0 commit comments