diff --git a/src/core/meshcop/dataset_manager.cpp b/src/core/meshcop/dataset_manager.cpp index 04800bed5..5dadd1189 100644 --- a/src/core/meshcop/dataset_manager.cpp +++ b/src/core/meshcop/dataset_manager.cpp @@ -257,6 +257,12 @@ void DatasetManager::Clear(void) Get().DeleteOperationalDataset(mType); mTimer.Stop(); + + if (IsPendingDataset()) + { + Get().mDelayTimer.Stop(); + } + SignalDatasetChange(); } @@ -863,21 +869,6 @@ PendingDatasetManager::PendingDatasetManager(Instance &aInstance) { } -void PendingDatasetManager::Clear(void) -{ - DatasetManager::Clear(); - mDelayTimer.Stop(); -} - -void PendingDatasetManager::ClearNetwork(void) -{ - Dataset dataset; - - mNetworkTimestamp.Clear(); - mNetworkTimestampValid = false; - IgnoreError(DatasetManager::Save(dataset)); -} - void PendingDatasetManager::StartDelayTimer(void) { Dataset dataset; diff --git a/src/core/meshcop/dataset_manager.hpp b/src/core/meshcop/dataset_manager.hpp index 5a683d045..49cd452d5 100644 --- a/src/core/meshcop/dataset_manager.hpp +++ b/src/core/meshcop/dataset_manager.hpp @@ -73,6 +73,12 @@ public: */ const Timestamp *GetTimestamp(void) const; + /** + * Clears the Operational Dataset. + * + */ + void Clear(void); + /** * Restores the Operational Dataset from non-volatile memory. * @@ -299,7 +305,6 @@ private: bool IsActiveDataset(void) const { return (mType == Dataset::kActive); } bool IsPendingDataset(void) const { return (mType == Dataset::kPending); } - void Clear(void); Error ApplyConfiguration(const Dataset &aDataset) const; void HandleGet(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo) const; void HandleTimer(void); @@ -391,12 +396,6 @@ public: */ bool IsCommissioned(void) const; - /** - * Clears the Active Operational Dataset. - * - */ - void Clear(void) { DatasetManager::Clear(); } - #if OPENTHREAD_FTD /** @@ -458,22 +457,6 @@ public: */ explicit PendingDatasetManager(Instance &aInstance); - /** - * Clears the Pending Operational Dataset. - * - * Also stops the Delay Timer if it was active. - * - */ - void Clear(void); - - /** - * Clears the network Pending Operational Dataset. - * - * Also stops the Delay Timer if it was active. - * - */ - void ClearNetwork(void); - #if OPENTHREAD_FTD /** * Starts the Leader functions for maintaining the Active Operational Dataset. diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index fa56d12d2..523db179d 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -3380,7 +3380,7 @@ void Mle::HandleChildIdResponse(RxInfo &aRxInfo) break; case kErrorNotFound: - Get().ClearNetwork(); + Get().Clear(); break; default: