]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Stop dropping old deltas when there are no new deltas
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 4 Dec 2023 20:25:38 +0000 (17:25 -0300)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 4 Dec 2023 20:39:46 +0000 (17:39 -0300)
__vrps_update() wasn't properly differentiating between a validation
cycle that errored from one that generated no deltas. Both were being
handled as failure.

Therefore, Fort might have been inducing more RTR Cache Resets than it
was supposed to. Although, iterations in which no deltas are generated
seem to be rare.

The removal of surplus error propagation in the previous commit
revealed that compute_deltas() cannot actually fail, which made
the solution here trivial.

src/rtr/db/vrps.c

index 8f4015b00d7cfc612b90ccef494346d015a35190..3bfe42f6dd33a8867078b8b782fee244e21de0c4 100644 (file)
@@ -225,21 +225,11 @@ __vrps_update(bool *changed)
        }
 
        rwlock_write_lock(&state_lock);
-
        state.base = new_base;
        state.serial++;
-       if (new_deltas != NULL) {
+       if (new_deltas != NULL)
                /* Ownership transferred */
                darray_add(state.deltas, new_deltas);
-       } else {
-               /*
-                * If the latest base has no deltas, all existing deltas are
-                * rendered useless. This is because clients always want to
-                * reach the latest serial, no matter where they are.
-                */
-               darray_clear(state.deltas);
-       }
-
        rwlock_unlock(&state_lock);
 
        if (old_base != NULL)