From: Ben Pfaff Date: Wed, 16 Jul 2008 18:14:23 +0000 (-0700) Subject: Fix behavior when system date is negative. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bc1162f6f4579b7ce8102de662895211d7f306f;p=openvswitch Fix behavior when system date is negative. 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. --- diff --git a/lib/learning-switch.c b/lib/learning-switch.c index 79858f4f..3b432d3b 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -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; diff --git a/lib/rconn.c b/lib/rconn.c index a6613ffe..8292401a 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -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