[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).
This commit is contained in:
Abtin Keshavarzian
2022-10-18 14:43:41 -07:00
committed by GitHub
parent aae250af89
commit 68083d8a67
+1 -16
View File
@@ -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);
}