From f873bed0573bc5fcabb9dba285ed259c9d45fbae Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 28 Jul 2008 07:08:38 -0700 Subject: [PATCH] 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. --- lib/rconn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.30.2