mirror of
https://github.com/espressif/openthread.git
synced 2026-08-30 22:09:54 +00:00
[dataset] returns OT_ERROR_REJECTED when MGMT_SET is rejected by leader (#9582)
The current code won't return a failure error code when a MGMT_SET request is rejected by the leader, so the client doesn't know whether the operation succeed or not. This commit fixes this issue by converting the REJECTED state to the OT_ERROR_REJECTED error code which is propagated back via the otDatasetMgmtSetCallback callback.
This commit is contained in:
@@ -312,15 +312,18 @@ void DatasetManager::HandleMgmtSetResponse(Coap::Message *aMessage, const Ip6::M
|
||||
OT_UNUSED_VARIABLE(aMessageInfo);
|
||||
|
||||
Error error;
|
||||
uint8_t state;
|
||||
uint8_t state = StateTlv::kPending;
|
||||
|
||||
SuccessOrExit(error = aError);
|
||||
VerifyOrExit(Tlv::Find<StateTlv>(*aMessage, state) == kErrorNone && state != StateTlv::kPending,
|
||||
error = kErrorParse);
|
||||
if (state == StateTlv::kReject)
|
||||
{
|
||||
error = kErrorRejected;
|
||||
}
|
||||
|
||||
exit:
|
||||
LogInfo("MGMT_SET finished: %s",
|
||||
error == kErrorNone ? StateTlv::StateToString(static_cast<StateTlv::State>(state)) : ErrorToString(error));
|
||||
LogInfo("MGMT_SET finished: %s", error == kErrorNone ? "Accepted" : ErrorToString(error));
|
||||
|
||||
mMgmtPending = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user