mirror of
https://github.com/espressif/openthread.git
synced 2026-10-06 07:47:41 +00:00
[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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user