From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Tue, 21 Dec 2021 15:00:15 +0000 (+0000) Subject: Ensure the interface is updated when the mastership is removed. X-Git-Tag: 1.2~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc4efb147b2448318f86438e83582d70eee49547;p=thirdparty%2Fnqptp.git Ensure the interface is updated when the mastership is removed. --- diff --git a/nqptp-clock-sources.c b/nqptp-clock-sources.c index 1faac43..0f0ae08 100644 --- a/nqptp-clock-sources.c +++ b/nqptp-clock-sources.c @@ -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 diff --git a/nqptp-message-handlers.c b/nqptp-message-handlers.c index edb4fce..c458959 100644 --- a/nqptp-message-handlers.c +++ b/nqptp-message-handlers.c @@ -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; } }