X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fcfm.c;h=730a00f81c8ae60f95e013ef5c3f0830b0ba0f5f;hb=2431be1b68d386bd616378d2c528242775c4d54a;hp=e8f86dc9f84f9721e449711e2775739f6af774d1;hpb=2bd135b5f88b1633042fe4dc99119bfbe14bd73e;p=sliver-openvswitch.git diff --git a/lib/cfm.c b/lib/cfm.c index e8f86dc9f..730a00f81 100644 --- a/lib/cfm.c +++ b/lib/cfm.c @@ -580,12 +580,27 @@ cfm_compose_ccm(struct cfm *cfm, struct ofpbuf *packet, void cfm_wait(struct cfm *cfm) OVS_EXCLUDED(mutex) { + poll_timer_wait_until(cfm_wake_time(cfm)); +} + + +/* Returns the next cfm wakeup time. */ +long long int +cfm_wake_time(struct cfm *cfm) OVS_EXCLUDED(mutex) +{ + long long int retval; + + if (!cfm) { + return LLONG_MAX; + } + ovs_mutex_lock(&mutex); - timer_wait(&cfm->tx_timer); - timer_wait(&cfm->fault_timer); + retval = MIN(cfm->tx_timer.t, cfm->fault_timer.t); ovs_mutex_unlock(&mutex); + return retval; } + /* Configures 'cfm' with settings from 's'. */ bool cfm_configure(struct cfm *cfm, const struct cfm_settings *s)