mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 15:50:36 +01:00
libnm-glib: ensure device state is updated when it changes
NM emits coalesced PropertiesChanged signals, which might be delayed slightly and thus sent after the StateChanged signal for devices. Clients of libnm-glib listening for the 'state-changed' signal and then querying the state manually using nm_device_get_state() would still see the old state until it was updated via the delayed PropertiesChanged signal processing. Since when the StateChanged signal comes in the device is already in the new state, just update the state and leave the GObject property notify signal to the PropertiesChanged signal handling code so that clients have an accurate device state.
This commit is contained in:
parent
6fe615bef5
commit
aef4340ec4
1 changed files with 9 additions and 1 deletions
|
|
@ -182,8 +182,16 @@ device_state_changed (DBusGProxy *proxy,
|
|||
{
|
||||
NMDevice *self = NM_DEVICE (user_data);
|
||||
|
||||
if (old_state != new_state)
|
||||
if (old_state != new_state) {
|
||||
/* Update state here since the PropertyChanged signal for state
|
||||
* might come in a bit later, but a client might ask for the
|
||||
* state via nm_device_get_state() as a result of this signal.
|
||||
* When the PC signal does come in that will trigger the glib
|
||||
* property notify signal so we don't need to do that here.
|
||||
*/
|
||||
NM_DEVICE_GET_PRIVATE (self)->state = new_state;
|
||||
g_signal_emit (self, signals[STATE_CHANGED], 0, new_state, old_state, reason);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue