From f49158e1666472ce4b7e80df76d2dfa95168c9c2 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Mon, 26 Feb 2018 13:55:34 -0800 Subject: [PATCH] [mle-router] simplify IsSleepyChildSubscribed() (#2584) --- src/core/thread/mle_router.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index 2d372e51d..62c9b9b5e 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -5059,22 +5059,8 @@ exit: bool MleRouter::IsSleepyChildSubscribed(const Ip6::Address &aAddress, Child &aChild) { - bool rval = false; - Ip6::Address address; - Child::Ip6AddressIterator iterator; - - VerifyOrExit(aChild.IsStateValidOrRestoring() && !aChild.IsRxOnWhenIdle()); - - while (aChild.GetNextIp6Address(GetInstance(), iterator, address) == OT_ERROR_NONE) - { - if (address == aAddress) - { - ExitNow(rval = true); - } - } - -exit: - return rval; + return aChild.IsStateValidOrRestoring() && !aChild.IsRxOnWhenIdle() && + aChild.HasIp6Address(GetInstance(), aAddress); } } // namespace Mle