From: Ben Pfaff Date: Mon, 28 Jul 2008 14:08:38 +0000 (-0700) Subject: Be slightly pickier about going into fail-open mode. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f873bed0573bc5fcabb9dba285ed259c9d45fbae;p=openvswitch Be slightly pickier about going into fail-open mode. Before, the amount of time disconnected was measured relative to the last time we connected, that is, the last time connect(2) succeeded. Thus, if we were connected for a long time, and then disconnected, we would immediately go into fail-open mode. This change make the disconnected time relative to the last OpenFlow message received. Thus, if we are connected for a long time and receive plenty of packets, and then disconnect, there will still be an opportunity to reconnect before failing open. --- diff --git a/lib/rconn.c b/lib/rconn.c index 5bd352b0..278ab575 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -496,7 +496,7 @@ rconn_is_connected(const struct rconn *rconn) int rconn_disconnected_duration(const struct rconn *rconn) { - return rconn_is_connected(rconn) ? 0 : time(0) - rconn->last_connected; + return rconn_is_connected(rconn) ? 0 : time(0) - rconn->last_received; } /* Returns the IP address of the peer, or 0 if the peer is not connected over