]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Wait for clients once the first validation cycle ends
authorpcarana <pc.moreno2099@gmail.com>
Fri, 13 Mar 2020 17:30:21 +0000 (11:30 -0600)
committerpcarana <pc.moreno2099@gmail.com>
Fri, 13 Mar 2020 17:30:21 +0000 (11:30 -0600)
docs/routers.md
src/updates_daemon.c

index 2db73e4504666619a691db4c379dc254821122e3..f5d2856bf83e77d537c5991df72526cee3c44b69 100644 (file)
@@ -48,9 +48,9 @@ Here are a few links to the RPKI configuration docs at some routers:
 
 ### (Re)start
 
-When Fort validator is run for the first time, the RTR server will wait for router connections at [`--server.address`](usage.html#--serveraddress):[`--server.port`](usage.html#--serverport) and will start its first validation cycle.
+When Fort validator is run for the first time, the RTR server will listen for router connections at [`--server.address`](usage.html#--serveraddress):[`--server.port`](usage.html#--serverport) once its first validation cycle ends.
 
-If a router establishes a connection with Fort before the first validation cycle ends, Fort will respond with a **"No Data Available"** RTR error, causing the router to wait some time (this will depend on each router) before asking for updates again.
+If a router tries to establish a connection with Fort before the first validation cycle ends, Fort won't respond at all, causing the router to wait some time (this will depend on each router) before asking for updates again.
 
 Once FORT validator ends its first validation cycle, it will share the resulting data (also known as "Validated ROA Payloads" or VRPs) with any router that establishes an RTR connection.
 
index 622c8bb15d32e2d0d94afce9f62d01543685267f..2306d6942911e981886a17152432458b79d1d5d5 100644 (file)
@@ -20,27 +20,25 @@ check_vrps_updates(void *param_void)
        int error;
 
        do {
+               sleep(config_get_validation_interval());
+
                error = vrps_update(&changed);
                if (error == -EINTR)
                        break; /* Process interrupted, terminate thread */
 
                if (error) {
-                       pr_err("Error code %d while trying to update the ROA database. Sleeping...",
-                           error);
-                       goto sleep;
+                       pr_err("Error while trying to update the ROA database. Sleeping...");
+                       continue;
                }
 
                if (changed) {
                        error = notify_clients();
                        if (error)
-                               pr_debug("Could not notify clients of the new VRPs. (Error code %d.) Sleeping...",
+                               pr_debug("Could't notify clients of the new VRPs. (Error code %d.) Sleeping...",
                                    error);
                        else
                                pr_debug("Database updated successfully. Sleeping...");
                }
-
-sleep:
-               sleep(config_get_validation_interval());
        } while (true);
 
        return NULL;
@@ -49,6 +47,13 @@ sleep:
 int
 updates_daemon_start(void)
 {
+       bool changed;
+       int error;
+
+       error = vrps_update(&changed);
+       if (error)
+               return pr_err("First validation wasn't successful.");
+
        errno = pthread_create(&thread, NULL, check_vrps_updates, NULL);
        if (errno)
                return -pr_errno(errno,