From db36fb52caa65784b2130e102fe43d3bcecc5827 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 2 Sep 2012 14:30:50 +0200 Subject: [PATCH] Reset the master/local frequency estimator when changing masters. Signed-off-by: Richard Cochran --- clock.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/clock.c b/clock.c index fc8e472..82692bc 100644 --- a/clock.c +++ b/clock.c @@ -117,6 +117,13 @@ static int clock_fault_timeout(struct clock *c, int index, int set) return timerfd_settime(c->fault_fd[index], 0, &tmo, NULL); } +static void clock_freq_est_reset(struct clock *c) +{ + c->fest.origin1 = tmv_zero(); + c->fest.ingress1 = tmv_zero(); + c->fest.count = 0; +}; + static int clock_management_response(struct clock *c, struct port *p, int id, struct ptp_message *req) { @@ -797,6 +804,7 @@ static void handle_state_decision_event(struct clock *c) cid2str(&best->dataset.identity)); if (c->best != best) { + clock_freq_est_reset(c); mave_reset(c->avg_delay); fresh_best = 1; }