From eec07ae24092517ba35e366b8629468fc9de66a4 Mon Sep 17 00:00:00 2001 From: Delio Brignoli Date: Wed, 30 Jan 2013 15:13:17 +0100 Subject: [PATCH] Fix fault-clearing timer being erroneously re-armed Arm the fault-clearing timer only when an event causes a port to change state to PS_FAULTY. Previously, if poll() returned because of an fd event other than the fault-clearing timeout, the fault clearing timer would re-arm for each port in PS_FAULTY state. Signed-off-by: Delio Brignoli --- clock.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/clock.c b/clock.c index b0a4de6..5d5ccbf 100644 --- a/clock.c +++ b/clock.c @@ -719,6 +719,10 @@ int clock_poll(struct clock *c) if (EV_ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES == event) lost = 1; port_dispatch(c->port[i], event, 0); + /* Clear any fault after a little while. */ + if (PS_FAULTY == port_state(c->port[i])) { + clock_fault_timeout(c, i, 1); + } } } @@ -728,11 +732,6 @@ int clock_poll(struct clock *c) clock_fault_timeout(c, i, 0); port_dispatch(c->port[i], EV_FAULT_CLEARED, 0); } - - /* Clear any fault after a little while. */ - if (PS_FAULTY == port_state(c->port[i])) { - clock_fault_timeout(c, i, 1); - } } /* Check the UDS port. */