]> git.ipfire.org Git - thirdparty/nqptp.git/commitdiff
Ensure the interface is updated when the mastership is removed.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Tue, 21 Dec 2021 15:00:15 +0000 (15:00 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Tue, 21 Dec 2021 15:00:15 +0000 (15:00 +0000)
nqptp-clock-sources.c
nqptp-message-handlers.c

index 1faac43391912899eb2ee22236543d2718c55e2d..0f0ae082a47dfbca023231b137f9d16a09b40d66 100644 (file)
@@ -353,11 +353,11 @@ void update_master() {
   }
   if (best_so_far == -1) {
     // no master clock
-    if (old_master != -1) {
+    //if (old_master != -1) {
       // but there was a master clock, so remove it
-      debug(2, "Remove master clock.");
+      debug(1, "Remove master clock.");
       update_master_clock_info(0, NULL, 0, 0, 0);
-    }
+    //}
     if (timing_peer_count == 0)
       debug(2, "no valid qualified clocks ");
     else
index edb4fce3a1e17b1dd553821b2f7abdfe2c4db2cc..c4589596354c00a66390f414f70f94359e8e7861 100644 (file)
@@ -42,8 +42,9 @@ void handle_control_port_messages(char *buf, ssize_t recv_len,
         clock_private_info[i].flags &=
             ~(1 << clock_is_a_timing_peer); // turn off peer flag (but not the master flag!)
         clock_private_info[i].announcements_without_followups = 0; // to allow a possibly silent clocks to be revisited when added to a timing peer list
-        if ((clock_private_info[i].flags &= ~(1 << clock_is_master)) != 0) {
-          clock_private_info[i].mastership_start_time = get_time_now(); // mastership is reset to this time...
+        if (strlen(buf) == 1) { // if it's giving an empty timing peer list, that means drop mastership from the past
+          clock_private_info[i].flags &= ~(1 << clock_is_master);
+          clock_private_info[i].mastership_start_time = 0;
           clock_private_info[i].previous_offset_time = 0;
         }
       }