device: Handle disconnect calls while connecting
If Disconnect is called during an ongoing connection attempt send a CMD_DEAUTHENTICATE command same as when we're already connected, and send a reply to potential dbus Connect call.
This commit is contained in:
parent
8b20019ded
commit
f468fceb02
12
src/device.c
12
src/device.c
|
@ -555,7 +555,9 @@ static void device_connect_cb(struct netdev *netdev, enum netdev_result result,
|
||||||
dbus_pending_reply(&device->connect_pending,
|
dbus_pending_reply(&device->connect_pending,
|
||||||
dbus_error_failed(device->connect_pending));
|
dbus_error_failed(device->connect_pending));
|
||||||
|
|
||||||
|
if (device->state == DEVICE_STATE_CONNECTING)
|
||||||
device_disassociated(device);
|
device_disassociated(device);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,10 +746,9 @@ static struct l_dbus_message *device_disconnect(struct l_dbus *dbus,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct device *device = user_data;
|
struct device *device = user_data;
|
||||||
struct network *network;
|
struct network *network = device->connected_network;
|
||||||
|
|
||||||
if (device->state == DEVICE_STATE_CONNECTING ||
|
if (device->state == DEVICE_STATE_DISCONNECTING)
|
||||||
device->state == DEVICE_STATE_DISCONNECTING)
|
|
||||||
return dbus_error_busy(message);
|
return dbus_error_busy(message);
|
||||||
|
|
||||||
if (!device->connected_bss)
|
if (!device->connected_bss)
|
||||||
|
@ -756,7 +757,10 @@ static struct l_dbus_message *device_disconnect(struct l_dbus *dbus,
|
||||||
if (netdev_disconnect(device->netdev, device_disconnect_cb, device) < 0)
|
if (netdev_disconnect(device->netdev, device_disconnect_cb, device) < 0)
|
||||||
return dbus_error_failed(message);
|
return dbus_error_failed(message);
|
||||||
|
|
||||||
network = device->connected_network;
|
if (device->state == DEVICE_STATE_CONNECTING)
|
||||||
|
if (device->connect_pending)
|
||||||
|
dbus_pending_reply(&device->connect_pending,
|
||||||
|
dbus_error_aborted(device->connect_pending));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the disconnect somehow fails we won't know if we're still
|
* If the disconnect somehow fails we won't know if we're still
|
||||||
|
|
Loading…
Reference in New Issue