@@ -351,6 +351,12 @@ void OperationalSessionSetup::DequeueConnectionCallbacks(CHIP_ERROR error, Sessi
351
351
auto * exchangeMgr = mInitParams .exchangeMgr ;
352
352
Optional<SessionHandle> optionalSessionHandle = mSecureSession .Get ();
353
353
ScopedNodeId peerId = mPeerId ;
354
+ System::Clock::Milliseconds16 requestedBusyDelay =
355
+ #if CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
356
+ mRequestedBusyDelay ;
357
+ #else
358
+ System::Clock::kZero ;
359
+ #endif // CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
354
360
355
361
if (releaseBehavior == ReleaseBehavior::Release)
356
362
{
@@ -361,14 +367,15 @@ void OperationalSessionSetup::DequeueConnectionCallbacks(CHIP_ERROR error, Sessi
361
367
// DO NOT touch any members of this object after this point. It's dead.
362
368
363
369
NotifyConnectionCallbacks (failureReady, setupFailureReady, successReady, error, stage, peerId, performingAddressUpdate,
364
- exchangeMgr, optionalSessionHandle);
370
+ exchangeMgr, optionalSessionHandle, requestedBusyDelay );
365
371
}
366
372
367
373
void OperationalSessionSetup::NotifyConnectionCallbacks (Cancelable & failureReady, Cancelable & setupFailureReady,
368
374
Cancelable & successReady, CHIP_ERROR error,
369
375
SessionEstablishmentStage stage, const ScopedNodeId & peerId,
370
376
bool performingAddressUpdate, Messaging::ExchangeManager * exchangeMgr,
371
- const Optional<SessionHandle> & optionalSessionHandle)
377
+ const Optional<SessionHandle> & optionalSessionHandle,
378
+ System::Clock::Milliseconds16 requestedBusyDelay)
372
379
{
373
380
//
374
381
// If we encountered no error, go ahead and call all success callbacks. Otherwise,
@@ -401,6 +408,12 @@ void OperationalSessionSetup::NotifyConnectionCallbacks(Cancelable & failureRead
401
408
{
402
409
// Initialize the ConnnectionFailureInfo object
403
410
ConnnectionFailureInfo failureInfo (peerId, error, stage);
411
+ #if CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
412
+ if (error == CHIP_ERROR_BUSY)
413
+ {
414
+ failureInfo.requestedBusyDelay .Emplace (requestedBusyDelay);
415
+ }
416
+ #endif // CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
404
417
cb->mCall (cb->mContext , failureInfo);
405
418
}
406
419
}
@@ -482,9 +495,9 @@ void OperationalSessionSetup::OnSessionEstablishmentError(CHIP_ERROR error, Sess
482
495
483
496
void OperationalSessionSetup::OnResponderBusy (System::Clock::Milliseconds16 requestedDelay)
484
497
{
485
- #if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
498
+ #if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES || CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
486
499
// Store the requested delay, so that we can use it for scheduling our
487
- // retry.
500
+ // retry or communicate it to our API consumer .
488
501
mRequestedBusyDelay = requestedDelay;
489
502
#endif
490
503
}
0 commit comments