From 1118500946a9e4f6f226bd7aceea79c3b32acc11 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Fri, 10 Jun 2022 15:01:10 +0200 Subject: [PATCH] Fix service remove marked as removed by Avahi (#19449) --- src/platform/Linux/DnssdImpl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/platform/Linux/DnssdImpl.cpp b/src/platform/Linux/DnssdImpl.cpp index 0ae581cc09b976..9b345b6a623122 100644 --- a/src/platform/Linux/DnssdImpl.cpp +++ b/src/platform/Linux/DnssdImpl.cpp @@ -654,9 +654,10 @@ void MdnsAvahi::HandleBrowse(AvahiServiceBrowser * browser, AvahiIfIndex interfa ChipLogProgress(DeviceLayer, "Avahi browse: remove"); if (strcmp("local", domain) == 0) { - std::remove_if(context->mServices.begin(), context->mServices.end(), [name, type](const DnssdService & service) { - return strcmp(name, service.mName) == 0 && type == GetFullType(service.mType, service.mProtocol); - }); + context->mServices.erase( + std::remove_if(context->mServices.begin(), context->mServices.end(), [name, type](const DnssdService & service) { + return strcmp(name, service.mName) == 0 && type == GetFullType(service.mType, service.mProtocol); + })); } break; case AVAHI_BROWSER_CACHE_EXHAUSTED: