mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 15:47:46 +00:00
[meshcop] fix issues in sending updated datasets to leader (#6813)
This commit fixes a couple issues with sending MGMT_SET.req to udpate the leader with a new operational datset. - When handling an MLE Child ID Response message, DatasetManager::Save() is called before the role is updated to child. As a result, a device with a newer dataset prior to attaching the network will not send a MGMT_SET.req message. This commit adds a delay to allow the role to change to child. - When receiving a MGMT_SET.rsp, the device will immediately check if it should send a MGMT_SET.req message again. However, the operational dataset may not have had a chance to propagate from the leader. This commit adds additional delay to allow the new operational dataset to propagate.
This commit is contained in:
@@ -167,8 +167,7 @@ Error DatasetManager::Save(const Dataset &aDataset)
|
||||
}
|
||||
else if (compare < 0)
|
||||
{
|
||||
VerifyOrExit(!Get<Mle::MleRouter>().IsLeader(), error = kErrorInvalidState);
|
||||
SendSet();
|
||||
mTimer.Start(kSendSetDelay);
|
||||
}
|
||||
|
||||
SignalDatasetChange();
|
||||
@@ -279,7 +278,7 @@ void DatasetManager::SendSet(void)
|
||||
Dataset dataset(GetType());
|
||||
|
||||
VerifyOrExit(!mCoapPending, error = kErrorBusy);
|
||||
VerifyOrExit(Get<Mle::MleRouter>().IsAttached(), error = kErrorInvalidState);
|
||||
VerifyOrExit(Get<Mle::MleRouter>().IsChild() || Get<Mle::MleRouter>().IsRouter(), error = kErrorInvalidState);
|
||||
VerifyOrExit(mLocal.Compare(GetTimestamp()) < 0, error = kErrorInvalidState);
|
||||
|
||||
if (IsActiveDataset())
|
||||
@@ -323,7 +322,7 @@ exit:
|
||||
break;
|
||||
|
||||
case kErrorNoBufs:
|
||||
mTimer.Start(kDelayNoBufs);
|
||||
mTimer.Start(kSendSetDelay);
|
||||
OT_FALL_THROUGH;
|
||||
|
||||
default:
|
||||
@@ -348,7 +347,7 @@ void DatasetManager::HandleCoapResponse(void * aContext,
|
||||
void DatasetManager::HandleCoapResponse(void)
|
||||
{
|
||||
mCoapPending = false;
|
||||
SendSet();
|
||||
mTimer.Start(kSendSetDelay);
|
||||
}
|
||||
|
||||
void DatasetManager::HandleGet(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo) const
|
||||
|
||||
@@ -363,7 +363,7 @@ private:
|
||||
enum
|
||||
{
|
||||
kMaxDatasetTlvs = 16, // Maximum number of TLVs in a Dataset.
|
||||
kDelayNoBufs = 1000, // Milliseconds
|
||||
kSendSetDelay = 5000, // Milliseconds
|
||||
};
|
||||
|
||||
bool mCoapPending : 1;
|
||||
|
||||
Reference in New Issue
Block a user