Skip to content

Commit

Permalink
[Darwin] Erase old services when they have been removed (#15572)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple authored and pull[bot] committed Jan 19, 2024
1 parent 4ae5eba commit 1181196
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/platform/Darwin/DnssdImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,13 @@ void OnBrowseRemove(BrowseContext * context, const char * name, const char * typ

VerifyOrReturn(strcmp(kLocalDot, domain) == 0);

std::remove_if(context->services.begin(), context->services.end(), [name, type, interfaceId](const DnssdService & service) {
return strcmp(name, service.mName) == 0 && type == GetFullType(service.mType, service.mProtocol) &&
service.mInterface == interfaceId;
});
context->services.erase(std::remove_if(context->services.begin(), context->services.end(),
[name, type, interfaceId](const DnssdService & service) {
return strcmp(name, service.mName) == 0 &&
type == GetFullType(service.mType, service.mProtocol) &&
service.mInterface == interfaceId;
}),
context->services.end());
}

static void OnBrowse(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceId, DNSServiceErrorType err, const char * name,
Expand Down

0 comments on commit 1181196

Please sign in to comment.