From: Ben Pfaff Date: Mon, 13 Oct 2008 20:56:26 +0000 (-0700) Subject: rconn: Never report being in failure mode while connected. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb7c717c31d168989d96e3685137cf88b8f6b30c;p=openvswitch rconn: Never report being in failure mode while connected. Change e10dfcf35, "rconn: Be pickier about what constitutes a successful connection," caused rconn to consider the connection to have failed even when we are actually connected until one of several message types was received. Unfortunately, that meant that "fail open" would intercept and discard all messages sent by the controller until one of those messages was received. Thus, the controller would never receive a reply to its feature_request, assume that the connection was busted, and disconnect. This happened forever, of course. Fixes bug #242. Thanks to Reid for reporting this and Dan for help in diagnosis. --- diff --git a/lib/rconn.c b/lib/rconn.c index 3865fc90..df0807cf 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -582,18 +582,15 @@ rconn_is_connected(const struct rconn *rconn) return is_connected_state(rconn->state); } -/* Returns 0 if 'rconn' is connected and the connection is believed to have - * been accepted by the controller. Otherwise, if 'rconn' is in a "failure - * mode" (that is, it is not connected or if it has recently connected and the - * controller is not yet believed to have made an admission control decision - * for this switch), returns the number of seconds that it has been in failure - * mode. */ +/* Returns 0 if 'rconn' is connected. Otherwise, if 'rconn' is in a "failure + * mode" (that is, it is not connected), returns the number of seconds that it + * has been in failure mode, ignoring any times that it connected but the + * controller's admission control policy caused it to be quickly + * disconnected. */ int rconn_failure_duration(const struct rconn *rconn) { - return (rconn_is_connected(rconn) && rconn->probably_admitted - ? 0 - : time_now() - rconn->last_admitted); + return rconn_is_connected(rconn) ? 0 : time_now() - rconn->last_admitted; } /* Returns the IP address of the peer, or 0 if the peer is not connected over