Browse Source

Move number of check endpoint to UA_Server_run_startup function

A late endpoint create is possible.
Martin Lang 6 years ago
parent
commit
9921548252
2 changed files with 6 additions and 7 deletions
  1. 0 7
      src/server/ua_server.c
  2. 6 0
      src/server/ua_server_worker.c

+ 0 - 7
src/server/ua_server.c

@@ -244,13 +244,6 @@ UA_Server_new(const UA_ServerConfig *config) {
     if(!config)
         return NULL;
 
-    /* At least one endpoint has to be configured */
-    if(config->endpointsSize == 0) {
-        UA_LOG_FATAL(config->logger, UA_LOGCATEGORY_SERVER,
-                     "There has to be at least one endpoint.");
-        return NULL;
-    }
-
     /* Allocate the server */
     UA_Server *server = (UA_Server *)UA_calloc(1, sizeof(UA_Server));
     if(!server)

+ 6 - 0
src/server/ua_server_worker.c

@@ -305,6 +305,12 @@ UA_StatusCode
 UA_Server_run_startup(UA_Server *server) {
     UA_Variant var;
     UA_StatusCode result = UA_STATUSCODE_GOOD;
+	
+	/* At least one endpoint has to be configured */
+    if(server->config.endpointsSize == 0) {
+        UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER,
+                       "There has to be at least one endpoint.");
+    }
 
     /* Sample the start time and set it to the Server object */
     server->startTime = UA_DateTime_now();