diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-17 03:34:47 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-17 03:34:47 +0100 |
| commit | d1e229c80a6e51ccc5b21d001271c41d6cda30bf (patch) | |
| tree | 7e58747b3332062b6319b8f1b172cb1b541e78dd /src | |
| parent | 3425cddd75fa105b940c8c0afe4a63065c446515 (diff) | |
| download | BobinkCOpcUa-d1e229c80a6e51ccc5b21d001271c41d6cda30bf.tar.gz BobinkCOpcUa-d1e229c80a6e51ccc5b21d001271c41d6cda30bf.zip | |
Improve comments in server_register.c
Remove a useless comment on an empty branch and add intent comments
before the manual event loop startup, the periodic re-registration
loop, and the shutdown deregistration block.
Diffstat (limited to 'src')
| -rw-r--r-- | src/server_register.c | 7 |
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, |
