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.
This commit is contained in:
Ben Pfaff committed 2008-07-28 07:08:38 -07:00
1 parent f12a593617
commit f873bed057
1 file changed
+1 -1
+1 -1
View File
@@ -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