[PATCH v2 4/9] Add new NMSettingsConnection reset_retries get/set methods



This patch adds get/set methods to NMSettingsConnection for the
reset_retries_timeout.  This allows sub-classes to override the
default setting ( 300s ).

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1461593

Gbp-Pq: Name Add-new-NMSettingsConnection-reset_retries-get-set-m.patch
---
 src/settings/nm-settings-connection.c | 18 +++++++++++++++++-
 src/settings/nm-settings-connection.h |  3 +++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index 6bed3fe..fa2b573 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -125,6 +125,7 @@ typedef struct {
 
        int autoconnect_retries;
        gint32 autoconnect_retry_time;
+       int reset_retries_timeout;
        NMDeviceStateReason autoconnect_blocked_reason;
 
        char *filename;
@@ -2407,7 +2408,8 @@ nm_settings_connection_set_autoconnect_retries (NMSettingsConnection *self,
        if (retries)
                priv->autoconnect_retry_time = 0;
        else
-               priv->autoconnect_retry_time = nm_utils_get_monotonic_timestamp_s () + 
AUTOCONNECT_RESET_RETRIES_TIMER;
+               priv->autoconnect_retry_time = nm_utils_get_monotonic_timestamp_s () + 
priv->reset_retries_timeout;
+
 }
 
 void
@@ -2416,6 +2418,19 @@ nm_settings_connection_reset_autoconnect_retries (NMSettingsConnection *self)
        nm_settings_connection_set_autoconnect_retries (self, AUTOCONNECT_RETRIES_DEFAULT);
 }
 
+int
+nm_settings_connection_get_reset_retries_timeout (NMSettingsConnection *connection)
+{
+       return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->reset_retries_timeout;
+}
+
+void
+nm_settings_connection_set_reset_retries_timeout (NMSettingsConnection *connection,
+                                                 int timeout)
+{
+       NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->reset_retries_timeout = timeout;
+}
+
 gint32
 nm_settings_connection_get_autoconnect_retry_time (NMSettingsConnection *self)
 {
@@ -2580,6 +2595,7 @@ nm_settings_connection_init (NMSettingsConnection *self)
 
        priv->autoconnect_retries = AUTOCONNECT_RETRIES_DEFAULT;
        priv->autoconnect_blocked_reason = NM_DEVICE_STATE_REASON_NONE;
+       priv->reset_retries_timeout = AUTOCONNECT_RESET_RETRIES_TIMER;
 
        g_signal_connect (self, NM_CONNECTION_SECRETS_CLEARED, G_CALLBACK (secrets_cleared_cb), NULL);
        g_signal_connect (self, NM_CONNECTION_CHANGED, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE));
diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h
index 5c12a8a..ece530a 100644
--- a/src/settings/nm-settings-connection.h
+++ b/src/settings/nm-settings-connection.h
@@ -208,6 +208,9 @@ void nm_settings_connection_set_autoconnect_retries (NMSettingsConnection *self,
                                                      int retries);
 void nm_settings_connection_reset_autoconnect_retries (NMSettingsConnection *self);
 
+int nm_settings_connection_get_reset_retries_timeout (NMSettingsConnection *connection);
+void nm_settings_connection_set_reset_retries_timeout (NMSettingsConnection *connection, int timeout);
+
 gint32 nm_settings_connection_get_autoconnect_retry_time (NMSettingsConnection *self);
 
 NMDeviceStateReason nm_settings_connection_get_autoconnect_blocked_reason (NMSettingsConnection *self);
-- 
2.7.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]