static gboolean carrier_action_defer_cb (gpointer user_data) { NMDeviceWired *self = NM_DEVICE_WIRED (user_data); NMDeviceWiredPrivate *priv = NM_DEVICE_WIRED_GET_PRIVATE (self); NMDeviceState state; priv->carrier_action_defer_id = 0; state = nm_device_get_state (NM_DEVICE (self)); if (state == NM_DEVICE_STATE_UNAVAILABLE) { if (priv->carrier) nm_device_queue_state (NM_DEVICE (self), NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_CARRIER); else { /* clear any queued state changes if they wouldn't be valid when the * carrier is off. */ if (nm_device_queued_state_peek (NM_DEVICE (self)) >= NM_DEVICE_STATE_DISCONNECTED) nm_device_queued_state_clear (NM_DEVICE (self)); } } else if (state >= NM_DEVICE_STATE_DISCONNECTED) { if (!priv->carrier) nm_device_queue_state (NM_DEVICE (self), NM_DEVICE_STATE_UNAVAILABLE, NM_DEVICE_STATE_REASON_CARRIER); } return FALSE; }
static void master_failed (NMActiveConnection *self) { NMDevice *device; NMDeviceState device_state; /* If the connection has an active device, fail it */ device = nm_active_connection_get_device (self); if (device) { device_state = nm_device_get_state (device); if (nm_device_is_activating (device) || (device_state == NM_DEVICE_STATE_ACTIVATED)) { nm_device_queue_state (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED); return; } } /* If no device, or the device wasn't active, just move to deactivated state */ nm_active_connection_set_state (self, NM_ACTIVE_CONNECTION_STATE_DEACTIVATED); }
static void find_companion (NMDeviceOlpcMesh *self) { NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self); const GSList *list; if (priv->companion) return; nm_device_add_pending_action (NM_DEVICE (self), "waiting for companion", TRUE); /* Try to find the companion if it's already known to the NMManager */ for (list = nm_manager_get_devices (nm_manager_get ()); list ; list = g_slist_next (list)) { if (check_companion (self, NM_DEVICE (list->data))) { nm_device_queue_state (NM_DEVICE (self), NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE); nm_device_remove_pending_action (NM_DEVICE (self), "waiting for companion", TRUE); break; } } }