[srp-server] skip looking for conflicts on host of the same key (#11716)

This commit is contained in:
Yakun Xu
2025-07-15 22:46:07 +08:00
committed by GitHub
parent 79d833ba3a
commit 1803a957e2
+9 -7
View File
@@ -507,15 +507,17 @@ bool Server::HasNameConflictsWith(Host &aHost) const
ExitNow(hasConflicts = true);
}
for (const Service &service : aHost.mServices)
for (const Host &host : mHosts)
{
// Check on all hosts for a matching service with the same
// instance name and if found, verify that it has the same
// key.
for (const Host &host : mHosts)
if (aHost.mKey == host.mKey)
{
if (host.HasService(service.GetInstanceName()) && (aHost.mKey != host.mKey))
continue;
}
// Verify that no allocated services have the same instance name.
for (const Service &service : aHost.mServices)
{
if (host.HasService(service.GetInstanceName()))
{
LogWarn("Name conflict: service name %s has already been allocated", service.GetInstanceName());
ExitNow(hasConflicts = true);