aboutsummaryrefslogtreecommitdiffstats
path: root/src/server_register.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/server_register.c')
-rw-r--r--src/server_register.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/server_register.c b/src/server_register.c
index c90fc31..60a4998 100644
--- a/src/server_register.c
+++ b/src/server_register.c
@@ -134,7 +134,6 @@ main (int argc, char **argv)
if (strcmp (clientAuthMode, "anonymous") == 0)
{
- /* No extra args needed */
}
else if (strcmp (clientAuthMode, "user") == 0)
{
@@ -187,6 +186,8 @@ main (int argc, char **argv)
serverConfig->applicationDescription.applicationType
= UA_APPLICATIONTYPE_SERVER;
+ /* Use run_startup + manual event loop (instead of UA_Server_run) so we
+ can periodically re-register with the LDS between iterations. */
UA_Server_run_startup (server);
/* UA_Server_registerDiscovery consumes (clears) the client config,
@@ -215,6 +216,8 @@ main (int argc, char **argv)
"Initial register failed: %s",
UA_StatusCode_name (retval));
+ /* Periodic re-registration loop. Re-register with the LDS every
+ registerInterval seconds so the LDS does not purge us. */
time_t lastRegister = time (NULL);
while (running)
@@ -246,6 +249,8 @@ main (int argc, char **argv)
}
}
+ /* Deregister from the LDS before shutting down so the LDS removes
+ our entry immediately rather than waiting for the cleanup timeout. */
memset (&clientConfig, 0, sizeof (UA_ClientConfig));
retval = createSecureClientConfig (
&clientConfig, applicationUri, clientCertPath, clientKeyPath, argv + idx,