about summary refs log tree commit diff
path: root/src/nm-active-connection.c
diff options
context:
space:
mode:
authorJeremy Bicha <jbicha@ubuntu.com>2018-03-26 08:35:51 -0400
committerJeremy Bicha <jbicha@ubuntu.com>2018-03-26 08:35:51 -0400
commit95410d8dcdd0433894612785c89b821b9de4cc04 (patch)
tree66c57586825b10af593a84a00ee885aa257b5196 /src/nm-active-connection.c
parent6b60d03d200147c516db40716b1c58e2a86db1a5 (diff)
parentaee9265c9325331914e9fd42ce06e063fabdfcab (diff)
Merge tag 'debian/1.10.6-2' into bionic
network-manager Debian release 1.10.6-2
Diffstat (limited to 'src/nm-active-connection.c')
-rw-r--r--src/nm-active-connection.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index 2286a74b..65f57565 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -292,6 +292,36 @@ nm_active_connection_set_state (NMActiveConnection *self,
 	}
 }
 
+void
+nm_active_connection_set_state_fail (NMActiveConnection *self,
+                                     NMActiveConnectionStateReason reason,
+                                     const char *error_desc)
+{
+	NMActiveConnectionState s;
+
+	g_return_if_fail (NM_IS_ACTIVE_CONNECTION (self));
+
+	if (error_desc) {
+		_LOGD ("Failed to activate '%s': %s",
+		       nm_active_connection_get_settings_connection_id (self),
+		       error_desc);
+	}
+
+	s = nm_active_connection_get_state (self);
+	if (   s >= NM_ACTIVE_CONNECTION_STATE_ACTIVATING
+	    && s < NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) {
+		nm_active_connection_set_state (self,
+		                                NM_ACTIVE_CONNECTION_STATE_DEACTIVATING,
+		                                reason);
+		s = nm_active_connection_get_state (self);
+	}
+	if (s < NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
+		nm_active_connection_set_state (self,
+		                                NM_ACTIVE_CONNECTION_STATE_DEACTIVATED,
+		                                reason);
+	}
+}
+
 NMActivationStateFlags
 nm_active_connection_get_state_flags (NMActiveConnection *self)
 {
@@ -1236,6 +1266,7 @@ set_property (GObject *object, guint prop_id,
 		nm_active_connection_set_device (self, g_value_get_object (value));
 		break;
 	case PROP_INT_SUBJECT:
+		/* construct-only */
 		priv->subject = g_value_dup_object (value);
 		break;
 	case PROP_INT_MASTER:
@@ -1251,6 +1282,7 @@ set_property (GObject *object, guint prop_id,
 		_set_activation_type (self, (NMActivationType) i);
 		break;
 	case PROP_SPECIFIC_OBJECT:
+		/* construct-only */
 		tmp = g_value_get_string (value);
 		/* NM uses "/" to mean NULL */
 		if (g_strcmp0 (tmp, "/") != 0)
@@ -1263,6 +1295,7 @@ set_property (GObject *object, guint prop_id,
 		priv->is_default6 = g_value_get_boolean (value);
 		break;
 	case PROP_VPN:
+		/* construct-only */
 		priv->vpn = g_value_get_boolean (value);
 		break;
 	case PROP_MASTER: