mirror of
https://github.com/espressif/openthread.git
synced 2026-08-29 21:39:54 +00:00
[commissioner] only allow attached device to become commissioner (#4120)
The commit addresses the issue that running "commissioner start" command when device role is detached will cause commissioner not be able to start or stop.
This commit is contained in:
@@ -144,6 +144,7 @@ otError Commissioner::Start(otCommissionerStateCallback aStateCallback,
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
VerifyOrExit(Get<Mle::MleRouter>().IsAttached(), error = OT_ERROR_INVALID_STATE);
|
||||
VerifyOrExit(mState == OT_COMMISSIONER_STATE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
SuccessOrExit(error = Get<Coap::CoapSecure>().Start(SendRelayTransmit, this));
|
||||
|
||||
Reference in New Issue
Block a user