From 68083d8a67ac0f1f780cf41a21487c0caffea461 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 18 Oct 2022 14:43:41 -0700 Subject: [PATCH] [srp-client] inform server on service remove even if not added yet (#8299) This commit updates `Srp::Client` so that on `RemoveService()` we always send an SRP Update message to server to remove the service even if the service is not yet registered (from perspective of client). --- src/core/net/srp_client.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/core/net/srp_client.cpp b/src/core/net/srp_client.cpp index e916d0ba1..ff642add0 100644 --- a/src/core/net/srp_client.cpp +++ b/src/core/net/srp_client.cpp @@ -575,16 +575,6 @@ Error Client::RemoveService(Service &aService) VerifyOrExit(mServices.Contains(aService), error = kErrorNotFound); UpdateServiceStateToRemove(aService); - - // Check if the service was removed immediately, if so - // invoke the callback to report the removed service. - GetRemovedServices(removedServices); - - if (!removedServices.IsEmpty()) - { - InvokeCallback(kErrorNone, mHostInfo, removedServices.GetHead()); - } - UpdateState(); exit: @@ -593,12 +583,7 @@ exit: void Client::UpdateServiceStateToRemove(Service &aService) { - if (aService.GetState() == kToAdd) - { - // If the service has not been added yet, we can remove it immediately. - aService.SetState(kRemoved); - } - else if (aService.GetState() != kRemoving) + if (aService.GetState() != kRemoving) { aService.SetState(kToRemove); }