if (timer_expired(&cfmi->fault_timer)) {
bool fault;
struct remote_mp *rmp;
+ long long int interval;
- fault = now < cfmi->x_recv_time + cfm_fault_interval(cfmi);
+ interval = cfm_fault_interval(cfmi);
+ fault = now < cfmi->x_recv_time + interval;
HMAP_FOR_EACH (rmp, node, &cfm->remote_mps) {
- if (timer_expired_at(&cfmi->fault_timer, rmp->recv_time)) {
+ if (rmp->recv_time < timer_enabled_at(&cfmi->fault_timer, interval)
+ || timer_expired_at(&cfmi->fault_timer, rmp->recv_time)) {
rmp->fault = true;
}
}
cfm->fault = fault;
- timer_set_duration(&cfmi->fault_timer, cfm_fault_interval(cfmi));
+ timer_set_duration(&cfmi->fault_timer, interval);
}
}
poll_timer_wait_until(timer->t);
}
}
+
+/* Returns the time at which 'timer' was set with 'duration'. Infinite timers
+ * were enabled at time LLONG_MAX. Manually expired timers were enabled at
+ * LLONG_MIN. */
+long long int
+timer_enabled_at(const struct timer *timer, long long int duration)
+{
+ switch (timer->t) {
+ case LLONG_MAX: return LLONG_MAX;
+ case LLONG_MIN: return LLONG_MIN;
+ default: return timer->t - duration;
+ }
+}
};
long long int timer_msecs_until_expired(const struct timer *);
+long long int timer_enabled_at(const struct timer *, long long int duration);
void timer_wait(const struct timer *);
/* Causes 'timer' to expire when 'duration' milliseconds have passed.