ofproto: Change semantics of configuration parameters.
authorBen Pfaff <blp@nicira.com>
Thu, 5 Mar 2009 20:28:36 +0000 (12:28 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 5 Mar 2009 20:28:36 +0000 (12:28 -0800)
Before, a value of 0 meant "no change".  Now, it means "use the default
value".  This turns out to be more useful.

secchan/ofproto.c

index c466ce3defd8890e04aa68bfbb114b6bb24bcfa7..9c54830a07f41a6d94b77e4ee125dd5fe2cb8379 100644 (file)
@@ -302,20 +302,18 @@ ofproto_set_datapath_id(struct ofproto *p, uint64_t datapath_id)
 void
 ofproto_set_probe_interval(struct ofproto *p, int probe_interval)
 {
-    if (probe_interval) {
-        rconn_set_probe_interval(p->controller->rconn, probe_interval);
-        if (p->fail_open) {
-            fail_open_set_trigger_duration(p->fail_open, probe_interval * 3);
-        }
+    probe_interval = probe_interval ? MAX(probe_interval, 5) : 0;
+    rconn_set_probe_interval(p->controller->rconn, probe_interval);
+    if (p->fail_open) {
+        int trigger_duration = probe_interval ? probe_interval * 3 : 15;
+        fail_open_set_trigger_duration(p->fail_open, trigger_duration);
     }
 }
 
 void
 ofproto_set_max_backoff(struct ofproto *p, int max_backoff)
 {
-    if (max_backoff) {
-        rconn_set_max_backoff(p->controller->rconn, max_backoff);
-    }
+    rconn_set_max_backoff(p->controller->rconn, max_backoff);
 }
 
 void