From 95866f54f4e65429a64cff3c92de73c9d140c368 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Thu, 8 May 2014 15:23:53 +0200 Subject: [PATCH] ctl: advertise wifi-connected changes after updating props If we advertise changes in Peer.Connected _before_ updating other props, they're not available in the callbacks. Delay the notifications after we parsed all props. Signed-off-by: David Herrmann --- src/ctl/ctl-wifi.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ctl/ctl-wifi.c b/src/ctl/ctl-wifi.c index 6cfcf88..a0caef3 100644 --- a/src/ctl/ctl-wifi.c +++ b/src/ctl/ctl-wifi.c @@ -195,14 +195,6 @@ static int ctl_peer_parse_properties(struct ctl_peer *p, } } - if (connected_set && p->connected != connected) { - p->connected = connected; - if (p->connected) - ctl_fn_peer_connected(p); - else - ctl_fn_peer_disconnected(p); - } - if (interface) { tmp = strdup(interface); if (tmp) { @@ -243,6 +235,15 @@ static int ctl_peer_parse_properties(struct ctl_peer *p, } } + /* do notifications last */ + if (connected_set && p->connected != connected) { + p->connected = connected; + if (p->connected) + ctl_fn_peer_connected(p); + else + ctl_fn_peer_disconnected(p); + } + return 0; }