Commit 2396c90c authored by Christian Kellner's avatar Christian Kellner
Browse files

device: update state directly after authorization

Before this change, the state of the device was update after
authorization either directly in the case of error or in the case of
successful authorization, indirectly via the uevent, which would then
lead to a call to device_update_from_udev.  As a result of this the
status would get updated only *after* the call to
bolt_device_authorize is already finished (and the D-Bus method return
on the client) for the brief period between the method return and the
uevent the status of the device would not reflect the actual state.

Therefore we now use bolt_auth_to_state to directly update the device
state in both, error and success, cases.  We still keep the uevent
mechanism in place because that ensures we will stay in sync with
external events (i.e.  events not cause by us).
parent 23cf06c0
......@@ -621,11 +621,10 @@ authorize_thread_done (GObject *object,
ok = g_task_propagate_boolean (task, &error);
if (!ok)
{
status = BOLT_STATUS_AUTH_ERROR;
g_object_set (dev, "status", status, NULL);
bolt_auth_return_error (auth, &error);
}
bolt_auth_return_error (auth, &error);
status = bolt_auth_to_status (auth);
g_object_set (dev, "status", status, NULL);
if (auth_data->callback)
auth_data->callback (G_OBJECT (dev),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment