2007-12-27 Dan Williams <dcbw@redhat.com>
* src/nm-device-interface.c src/nm-device-interface.h - (nm_device_interface_error_quark, nm_device_interface_error_get_type): normalize and expand errors - (nm_device_interface_init): register errors so they can be marshalled through dbus-glib - (nm_device_interface_activate): ensure that failure of activation returns an error * src/nm-device.c src/nm-device.h - (device_activation_precheck): implementations of check_connection() now take a GError and must fill it in if the check fails. Return more descriptive error if the requested connection is already activating - (nm_device_activate): actually try to return descriptive errors on failures * src/nm-device-802-11-wireless.c src/nm-device-802-3-ethernet.c src/nm-serial-device.c src/nm-gsm-device.c - (real_check_connection): return more descriptive errors on failure * src/NetworkManagerPolicy.c - (nm_policy_device_change_check): print activation errors in the logs * src/nm-manager.c - (nm_manager_error_quark, nm_manager_error_get_type, nm_manager_class_init): new errors - (nm_manager_activate_device): handle errors - (nm_manager_error_new): removed - (wait_for_connection_expired, connection_added_default_handler, impl_manager_activate_device): better error handling git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3197 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -83,7 +83,8 @@ struct _NMDevicePrivate
|
||||
};
|
||||
|
||||
static gboolean nm_device_activate (NMDeviceInterface *device,
|
||||
NMActRequest *req);
|
||||
NMActRequest *req,
|
||||
GError **error);
|
||||
|
||||
static void nm_device_activate_schedule_stage5_ip_config_commit (NMDevice *self);
|
||||
static void nm_device_deactivate (NMDeviceInterface *device);
|
||||
@@ -1128,16 +1129,18 @@ connection_secrets_failed_cb (NMActRequest *req,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
device_activation_precheck (NMDevice *self, NMConnection *connection)
|
||||
device_activation_precheck (NMDevice *self, NMConnection *connection, GError **error)
|
||||
{
|
||||
NMConnection *current_connection;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
|
||||
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
|
||||
|
||||
if (!NM_DEVICE_GET_CLASS (self)->check_connection (self, connection))
|
||||
if (!NM_DEVICE_GET_CLASS (self)->check_connection (self, connection, error)) {
|
||||
/* connection is invalid */
|
||||
g_assert (*error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (nm_device_get_state (self) != NM_DEVICE_STATE_ACTIVATED)
|
||||
return TRUE;
|
||||
@@ -1146,22 +1149,30 @@ device_activation_precheck (NMDevice *self, NMConnection *connection)
|
||||
return TRUE;
|
||||
|
||||
current_connection = nm_act_request_get_connection (nm_device_get_act_request (self));
|
||||
if (nm_connection_compare (connection, current_connection))
|
||||
if (nm_connection_compare (connection, current_connection)) {
|
||||
/* Already activating or activated with the same connection */
|
||||
g_set_error (error,
|
||||
NM_DEVICE_INTERFACE_ERROR,
|
||||
NM_DEVICE_INTERFACE_ERROR_CONNECTION_ACTIVATING,
|
||||
"%s", "Connection is already activating");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
nm_device_activate (NMDeviceInterface *device,
|
||||
NMActRequest *req)
|
||||
NMActRequest *req,
|
||||
GError **error)
|
||||
{
|
||||
NMDevice *self = NM_DEVICE (device);
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
if (!device_activation_precheck (self, nm_act_request_get_connection (req)))
|
||||
if (!device_activation_precheck (self, nm_act_request_get_connection (req), error)) {
|
||||
g_assert (*error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
priv->act_request = g_object_ref (req);
|
||||
priv->secrets_updated_id = g_signal_connect (req,
|
||||
|
Reference in New Issue
Block a user