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.
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