From 19ac977b08be209ce01cd14b874e5d694a1c0939 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Fri, 8 May 2020 18:11:16 -0700 Subject: [PATCH] [address-resolver] change SendAddressError() to return void (#4941) --- src/core/thread/address_resolver.cpp | 22 ++++++++++++---------- src/core/thread/address_resolver.hpp | 12 +++++------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/core/thread/address_resolver.cpp b/src/core/thread/address_resolver.cpp index c39c1efe1..6547526d5 100644 --- a/src/core/thread/address_resolver.cpp +++ b/src/core/thread/address_resolver.cpp @@ -633,8 +633,7 @@ void AddressResolver::HandleAddressNotification(Coap::Message &aMessage, const I // by more than one device. Try to resolve the duplicate // address by sending an Address Error message. - VerifyOrExit(entry->HasMeshLocalIid(meshLocalIid), - IgnoreError(SendAddressError(target, meshLocalIid, NULL))); + VerifyOrExit(entry->HasMeshLocalIid(meshLocalIid), SendAddressError(target, meshLocalIid, NULL)); VerifyOrExit(lastTransactionTime < entry->GetLastTransactionTime(), OT_NOOP); } @@ -660,9 +659,9 @@ exit: return; } -otError AddressResolver::SendAddressError(const Ip6::Address &aTarget, - const uint8_t * aMeshLocalIid, - const Ip6::Address *aDestination) +void AddressResolver::SendAddressError(const Ip6::Address &aTarget, + const uint8_t * aMeshLocalIid, + const Ip6::Address *aDestination) { otError error; Coap::Message * message; @@ -696,12 +695,15 @@ otError AddressResolver::SendAddressError(const Ip6::Address &aTarget, exit: - if (error != OT_ERROR_NONE && message != NULL) + if (error != OT_ERROR_NONE) { - message->Free(); - } + otLogInfoArp("Failed to send address error: %s", otThreadErrorToString(error)); - return error; + if (message != NULL) + { + message->Free(); + } + } } void AddressResolver::HandleAddressError(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo) @@ -766,7 +768,7 @@ void AddressResolver::HandleAddressError(Coap::Message &aMessage, const Ip6::Mes { SuccessOrExit(error = Get().GetLocatorAddress(destination, child.GetRloc16())); - IgnoreError(SendAddressError(target, meshLocalIid, &destination)); + SendAddressError(target, meshLocalIid, &destination); ExitNow(); } } diff --git a/src/core/thread/address_resolver.hpp b/src/core/thread/address_resolver.hpp index 51f74fac2..dcf6608a7 100644 --- a/src/core/thread/address_resolver.hpp +++ b/src/core/thread/address_resolver.hpp @@ -277,13 +277,11 @@ private: void RemoveCacheEntry(CacheEntry &aEntry, CacheEntryList &aList, CacheEntry *aPrevEntry, Reason aReason); otError SendAddressQuery(const Ip6::Address &aEid); - otError SendAddressError(const Ip6::Address &aTarget, - const uint8_t * aMeshLocalIid, - const Ip6::Address *aDestination); - void SendAddressQueryResponse(const Ip6::Address &aTarget, - const uint8_t * aMeshLocalIid, - const uint32_t * aLastTransactionTimeTlv, - const Ip6::Address &aDestination); + void SendAddressError(const Ip6::Address &aTarget, const uint8_t *aMeshLocalIid, const Ip6::Address *aDestination); + void SendAddressQueryResponse(const Ip6::Address &aTarget, + const uint8_t * aMeshLocalIid, + const uint32_t * aLastTransactionTimeTlv, + const Ip6::Address &aDestination); static void HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);