Skip to content

Commit

Permalink
Eliminate duplicate endpoints when Configured base addresses differ b…
Browse files Browse the repository at this point in the history
…y port only
  • Loading branch information
mrsuciu committed Jan 27, 2022
1 parent ac13151 commit f9a6509
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions Stack/Opc.Ua.Core/Stack/Server/ServerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,12 @@ private static string GetBestDiscoveryUrl(Uri clientUrl, BaseAddress baseAddress
continue;
}

if (endpointUrl.Port != baseAddress.Url.Port)
{
continue;
}


EndpointDescription translation = new EndpointDescription();

translation.EndpointUrl = baseAddress.Url.ToString();
Expand All @@ -1094,22 +1100,8 @@ private static string GetBestDiscoveryUrl(Uri clientUrl, BaseAddress baseAddress
translation.UserIdentityTokens = endpoint.UserIdentityTokens;
translation.Server = application;

// skip duplicates.
bool duplicateFound = false;
translations.Add(translation);

foreach (EndpointDescription existingTranslation in translations)
{
if (existingTranslation.IsEqual(translation))
{
duplicateFound = true;
break;
}
}

if (!duplicateFound)
{
translations.Add(translation);
}
}
}

Expand Down

0 comments on commit f9a6509

Please sign in to comment.