mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-03 19:02:34 +01:00
device: Modify disconnect_cb logic
Calling device_disassociated inside disconnect_cb was mostly pointless. Most attributes were already cleared by device_disconnect() when initiating the disconnection procedure. This patch also modifies the logic for triggering the autoconnect. If the user initiated the disconnect call, then autoconnect should not be triggered. If the disconnect was triggered by other means, then iwd will still enter autoconnect mode.
This commit is contained in:
parent
30947414e4
commit
b601c99123
13
src/device.c
13
src/device.c
@ -774,6 +774,7 @@ static void device_disconnect_cb(struct netdev *netdev, bool success,
|
||||
void *user_data)
|
||||
{
|
||||
struct device *device = user_data;
|
||||
bool trigger_autoconnect = true;
|
||||
|
||||
l_debug("%d, success: %d", device->index, success);
|
||||
|
||||
@ -789,9 +790,19 @@ static void device_disconnect_cb(struct netdev *netdev, bool success,
|
||||
|
||||
|
||||
dbus_pending_reply(&device->disconnect_pending, reply);
|
||||
|
||||
/*
|
||||
* If the disconnect was triggered by the user, don't
|
||||
* autoconnect. Wait for user's explicit instructions to scan
|
||||
* and connect to the network
|
||||
*/
|
||||
trigger_autoconnect = false;
|
||||
}
|
||||
|
||||
device_disassociated(device);
|
||||
device_enter_state(device, DEVICE_STATE_DISCONNECTED);
|
||||
|
||||
if (trigger_autoconnect)
|
||||
device_enter_state(device, DEVICE_STATE_AUTOCONNECT);
|
||||
}
|
||||
|
||||
int device_disconnect(struct device *device)
|
||||
|
Loading…
Reference in New Issue
Block a user