Fix behavior when system date is negative.
authorBen Pfaff <blp@nicira.com>
Wed, 16 Jul 2008 18:14:23 +0000 (11:14 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 18 Jul 2008 20:24:16 +0000 (13:24 -0700)
Previously we set a few timers to expire at a time_t of 0, i.e.
immediately.  But if the system date is set incorrectly to a date
before 1970, then these timers will essentially never expire.
Set them to expire at TIME_MIN instead.

lib/learning-switch.c
lib/rconn.c

index 79858f4..3b432d3 100644 (file)
@@ -87,7 +87,7 @@ lswitch_create(struct rconn *rconn, bool learn_macs, int max_idle)
     memset(sw, 0, sizeof *sw);
     sw->max_idle = max_idle;
     sw->datapath_id = 0;
-    sw->last_features_request = 0;
+    sw->last_features_request = time(0) - 1;
     sw->ml = learn_macs ? mac_learning_create() : NULL;
     send_features_request(sw, rconn);
     return sw;
index a6613ff..8292401 100644 (file)
@@ -345,7 +345,7 @@ create_rconn(const char *name, int txq_limit, int probe_interval,
     rc->vconn = vconn;
     queue_init(&rc->txq);
     rc->txq_limit = txq_limit;
-    rc->backoff_deadline = 0;
+    rc->backoff_deadline = time(0);
     rc->backoff = 0;
     rc->last_connected = time(0);
     rc->probe_interval = (probe_interval