Skip to content

Commit

Permalink
wireless: wait for linkUP instead of linkAssosciate
Browse files Browse the repository at this point in the history
  • Loading branch information
wipawel committed Oct 6, 2014
1 parent 14a7218 commit 1a2134f
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/dbus-objects/wireless.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ ni_objectmodel_wireless_change_device(ni_dbus_object_t *object, const ni_dbus_me
ni_netdev_t *dev;
ni_wireless_t *wlan;
ni_wireless_network_t *net;
dbus_bool_t rv = FALSE;

if (!(dev = ni_objectmodel_unwrap_netif(object, error)))
return FALSE;
Expand Down Expand Up @@ -113,9 +112,6 @@ ni_objectmodel_wireless_change_device(ni_dbus_object_t *object, const ni_dbus_me
goto error;
}

dbus_bool_t was_up = FALSE;
was_up = (wlan->assoc.state == NI_WIRELESS_ESTABLISHED);

switch (net->keymgmt_proto) {
case NI_WIRELESS_KEY_MGMT_PSK:
if (net->wpa_psk.passphrase == NULL) {
Expand Down Expand Up @@ -158,21 +154,8 @@ ni_objectmodel_wireless_change_device(ni_dbus_object_t *object, const ni_dbus_me
goto error;
}

if (!was_up || wlan->assoc.state == NI_WIRELESS_ESTABLISHED) {
rv = TRUE;
} else {
const ni_uuid_t *uuid;

/* Link is not associated yet. Tell the caller to wait for an event. */
uuid = ni_netdev_add_event_filter(dev,
(1 << NI_EVENT_LINK_ASSOCIATED) |
(1 << NI_EVENT_LINK_ASSOCIATION_LOST));
rv = __ni_objectmodel_return_callback_info(reply, NI_EVENT_LINK_ASSOCIATED,
uuid, NULL, error);
}

ni_wireless_network_put(net);
return rv;
return TRUE;

error:
ni_wireless_network_put(net);
Expand Down

0 comments on commit 1a2134f

Please sign in to comment.