From 90eda6ef6bc913b4c9af79eba26bbaf34737eb42 Mon Sep 17 00:00:00 2001 From: Jiacheng Guo Date: Tue, 7 Jan 2020 00:16:58 +0800 Subject: [PATCH] [mle] fix build error caused by GetParent return type change (#4437) The GetParent return type was updated in 1996d42. --- examples/platforms/posix/openthread-core-posix-config.h | 5 +++++ src/core/thread/mle.cpp | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/platforms/posix/openthread-core-posix-config.h b/examples/platforms/posix/openthread-core-posix-config.h index 242491f02..627d76cbe 100644 --- a/examples/platforms/posix/openthread-core-posix-config.h +++ b/examples/platforms/posix/openthread-core-posix-config.h @@ -136,4 +136,9 @@ #ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE #define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 1 #endif + +#ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE +#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 +#endif + #endif // OPENTHREAD_CORE_POSIX_CONFIG_H_ diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 8d682257e..df9cf6719 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -201,10 +201,6 @@ Mle::Mle(Instance &aInstance) // `SetMeshLocalPrefix()` also adds the Mesh-Local EID and subscribes // to the Link- and Realm-Local All Thread Nodes multicast addresses. - -#if OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE - StartParentSearchTimer(); -#endif } otError Mle::Enable(void) @@ -217,6 +213,9 @@ otError Mle::Enable(void) SuccessOrExit(error = mSocket.Open(&Mle::HandleUdpReceive, this)); SuccessOrExit(error = mSocket.Bind(sockaddr)); +#if OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE + StartParentSearchTimer(); +#endif exit: return error; } @@ -4057,7 +4056,7 @@ void Mle::HandleParentSearchTimer(void) VerifyOrExit(mRole == OT_DEVICE_ROLE_CHILD); - parentRss = GetParent()->GetLinkInfo().GetAverageRss(); + parentRss = GetParent().GetLinkInfo().GetAverageRss(); otLogInfoMle("PeriodicParentSearch: Parent RSS %d", parentRss); VerifyOrExit(parentRss != OT_RADIO_RSSI_INVALID);