[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:
Simon Lin
2019-08-30 09:04:42 -07:00
committed by Jonathan Hui
parent 528e7d5992
commit 3c402a7485
+1
View File
@@ -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));