From: Ben Pfaff Date: Tue, 17 Mar 2009 17:51:21 +0000 (-0700) Subject: secchan: Make expire_rule() slightly easier to read. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc36e8ce95807809efdf7c417b69eae523894385;p=openvswitch secchan: Make expire_rule() slightly easier to read. Search-and-replace "expiration" by "expire". In the next commit this will keep from needing to wrap more lines, making the code easier to read there too. --- diff --git a/secchan/ofproto.c b/secchan/ofproto.c index d27cc3bf..f778c0e4 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -2894,23 +2894,22 @@ expire_rule(struct cls_rule *cls_rule, void *p_) { struct ofproto *p = p_; struct rule *rule = rule_from_cls_rule(cls_rule); - long long int hard_expiration, idle_expiration, expiration, now; - - hard_expiration = (rule->hard_timeout - ? rule->created + rule->hard_timeout * 1000 - : LLONG_MAX); - idle_expiration = (rule->idle_timeout - && (rule->super || list_is_empty(&rule->list)) - ? rule->used + rule->idle_timeout * 1000 - : LLONG_MAX); - expiration = MIN(hard_expiration, idle_expiration); - - if (expiration == LLONG_MAX) { + long long int hard_expire, idle_expire, expire, now; + + hard_expire = (rule->hard_timeout + ? rule->created + rule->hard_timeout * 1000 + : LLONG_MAX); + idle_expire = (rule->idle_timeout + && (rule->super || list_is_empty(&rule->list)) + ? rule->used + rule->idle_timeout * 1000 + : LLONG_MAX); + expire = MIN(hard_expire, idle_expire); + if (expire == LLONG_MAX) { return; } now = time_msec(); - if (now < expiration) { + if (now < expire) { return; } @@ -2934,7 +2933,7 @@ expire_rule(struct cls_rule *cls_rule, void *p_) } send_flow_exp(p, rule, now, - (now >= hard_expiration + (now >= hard_expire ? OFPER_HARD_TIMEOUT : OFPER_IDLE_TIMEOUT)); classifier_remove(&p->cls, &rule->cr); rule_destroy(rule);