settings/trivial: rename nm_settings_connection_autoconnect_retries_blocked_until()

NMSettingsConnection has 3 properties that are related to autoconnect:
  - autoconnect_retries
  - autoconnect_blocked_until
  - autoconnect_blocked_reason

autoconnect_blocked_reason is entirely independent from the other two.
A connection have have autoconnect blocked via a blocked-reason, but the
retry count is not affected by that. The retry count is an independent
mechanism, that may additionally prevent autoconnect.

However autoconnect_retries and autoconnect_retries_blocked_until are
strongly related. The latter is set if and only if autoconnect_retries is
at zero.

Rename to reflect that better.
This commit is contained in:
Thomas Haller 2017-11-22 14:58:09 +01:00
parent 4e7b05de79
commit 955432ca87
3 changed files with 11 additions and 11 deletions

View file

@ -1507,7 +1507,7 @@ reset_connections_retries (gpointer user_data)
for (i = 0; connections[i]; i++) {
NMSettingsConnection *connection = connections[i];
con_stamp = nm_settings_connection_autoconnect_blocked_until_get (connection);
con_stamp = nm_settings_connection_autoconnect_retries_blocked_until (connection);
if (con_stamp == 0)
continue;
@ -1737,7 +1737,7 @@ device_state_changed (NMDevice *device,
nm_settings_connection_get_id (connection));
/* Schedule a handler to reset retries count */
if (!priv->reset_retries_id) {
gint32 retry_time = nm_settings_connection_autoconnect_blocked_until_get (connection);
gint32 retry_time = nm_settings_connection_autoconnect_retries_blocked_until (connection);
g_warn_if_fail (retry_time != 0);
priv->reset_retries_id = g_timeout_add_seconds (MAX (0, retry_time - nm_utils_get_monotonic_timestamp_s ()), reset_connections_retries, self);

View file

@ -44,9 +44,9 @@
#define SETTINGS_TIMESTAMPS_FILE NMSTATEDIR "/timestamps"
#define SETTINGS_SEEN_BSSIDS_FILE NMSTATEDIR "/seen-bssids"
#define AUTOCONNECT_RETRIES_UNSET -2
#define AUTOCONNECT_RETRIES_FOREVER -1
#define AUTOCONNECT_RETRIES_DEFAULT 4
#define AUTOCONNECT_RETRIES_UNSET -2
#define AUTOCONNECT_RETRIES_FOREVER -1
#define AUTOCONNECT_RETRIES_DEFAULT 4
#define AUTOCONNECT_RESET_RETRIES_TIMER 300
/*****************************************************************************/
@ -111,7 +111,7 @@ typedef struct _NMSettingsConnectionPrivate {
GHashTable *seen_bssids; /* Up-to-date BSSIDs that's been seen for the connection */
int autoconnect_retries;
gint32 autoconnect_blocked_until;
gint32 autoconnect_retries_blocked_until;
char *filename;
} NMSettingsConnectionPrivate;
@ -2573,13 +2573,13 @@ nm_settings_connection_autoconnect_retries_set (NMSettingsConnection *self,
priv->autoconnect_retries = retries;
}
if (retries)
priv->autoconnect_blocked_until = 0;
priv->autoconnect_retries_blocked_until = 0;
else {
/* XXX: the blocked time must be identical for all connections, otherwise
* the tracking of resetting the retry count in NMPolicy needs adjustment
* (as it would need to re-evaluate the next-timeout everytime a
* connection gets blocked). */
priv->autoconnect_blocked_until = nm_utils_get_monotonic_timestamp_s () + AUTOCONNECT_RESET_RETRIES_TIMER;
priv->autoconnect_retries_blocked_until = nm_utils_get_monotonic_timestamp_s () + AUTOCONNECT_RESET_RETRIES_TIMER;
}
}
@ -2590,9 +2590,9 @@ nm_settings_connection_autoconnect_retries_reset (NMSettingsConnection *self)
}
gint32
nm_settings_connection_autoconnect_blocked_until_get (NMSettingsConnection *self)
nm_settings_connection_autoconnect_retries_blocked_until (NMSettingsConnection *self)
{
return NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->autoconnect_blocked_until;
return NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->autoconnect_retries_blocked_until;
}
NMSettingsAutoconnectBlockedReason

View file

@ -218,7 +218,7 @@ void nm_settings_connection_autoconnect_retries_set (NMSettingsConnection *self,
int retries);
void nm_settings_connection_autoconnect_retries_reset (NMSettingsConnection *self);
gint32 nm_settings_connection_autoconnect_blocked_until_get (NMSettingsConnection *self);
gint32 nm_settings_connection_autoconnect_retries_blocked_until (NMSettingsConnection *self);
NMSettingsAutoconnectBlockedReason nm_settings_connection_autoconnect_blocked_reason_get (NMSettingsConnection *self);
void nm_settings_connection_autoconnect_blocked_reason_set (NMSettingsConnection *self,