Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Server] Fix Shutdown Delay when registration is enabled no LDS is present. #2589

Merged
merged 4 commits into from
May 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions Libraries/Opc.Ua.Server/Server/StandardServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,8 @@
{
client.RegisterServer(requestHeader, m_registrationInfo);
}


Check warning on line 2328 in Libraries/Opc.Ua.Server/Server/StandardServer.cs

View check run for this annotation

Codecov / codecov/patch

Libraries/Opc.Ua.Server/Server/StandardServer.cs#L2328

Added line #L2328 was not covered by tests
m_registeredWithDiscoveryServer = m_registrationInfo.IsOnline;
return true;
}
catch (Exception e)
Expand Down Expand Up @@ -2362,7 +2363,7 @@
configuration.CertificateValidator.CertificateValidation -= registrationCertificateValidator;
}
}

m_registeredWithDiscoveryServer = false;
return false;
}

Expand Down Expand Up @@ -3007,6 +3008,7 @@

m_registrationEndpoints.Add(endpoint);

m_registeredWithDiscoveryServer = false;
m_minRegistrationInterval = 1000;
m_lastRegistrationInterval = m_minRegistrationInterval;

Expand Down Expand Up @@ -3075,9 +3077,10 @@
// attempt graceful shutdown the server.
try
{
if (m_maxRegistrationInterval > 0)

if (m_maxRegistrationInterval > 0 && m_registeredWithDiscoveryServer)
{
// unregister from Discovery Server
// unregister from Discovery Server if registered before
m_registrationInfo.IsOnline = false;
RegisterWithDiscoveryServer();
}
Expand Down Expand Up @@ -3353,6 +3356,7 @@
private int m_minRegistrationInterval;
private int m_maxRegistrationInterval;
private int m_lastRegistrationInterval;
private bool m_registeredWithDiscoveryServer;
private int m_minNonceLength;
private bool m_useRegisterServer2;
private List<INodeManagerFactory> m_nodeManagerFactories;
Expand Down