mirror of
https://github.com/espressif/openthread.git
synced 2026-10-12 02:37:37 +00:00
[mle] simplify condition in Mle::BecomeDetached() (#10796)
This commit updates the skip condition in `BecomeDetached()` to use positive boolean checks for improved readability. This condition applies when the device is already detached and is about to start an attach attempt.
This commit is contained in:
@@ -501,11 +501,12 @@ Error Mle::BecomeDetached(void)
|
||||
|
||||
VerifyOrExit(!IsDisabled(), error = kErrorInvalidState);
|
||||
|
||||
// In case role is already detached and attach state is `kAttachStateStart`
|
||||
// (i.e., waiting to start an attach attempt), there is no need to make any
|
||||
// changes.
|
||||
|
||||
VerifyOrExit(!IsDetached() || mAttachState != kAttachStateStart);
|
||||
if (IsDetached() && (mAttachState == kAttachStateStart))
|
||||
{
|
||||
// Already detached and waiting to start an attach attempt, so
|
||||
// there is not need to make any changes.
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
// Not in reattach stage after reset
|
||||
if (mReattachState == kReattachStop)
|
||||
|
||||
Reference in New Issue
Block a user