mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 11:52:34 +01:00
device: Simplify reply logic in device_connect_cb
Also, remove the check for device->state == DEVICE_STATE_CONNECTING. device_connect_cb should always called when the state is CONNECTING. If this is not so, it indicates a bug inside the netdev layer.
This commit is contained in:
parent
f4201d06c2
commit
d95f9a29c5
38
src/device.c
38
src/device.c
@ -582,33 +582,31 @@ static void device_connect_cb(struct netdev *netdev, enum netdev_result result,
|
|||||||
{
|
{
|
||||||
struct device *device = user_data;
|
struct device *device = user_data;
|
||||||
|
|
||||||
if (result != NETDEV_RESULT_OK) {
|
|
||||||
struct l_dbus_message *reply;
|
|
||||||
|
|
||||||
if (device->connect_pending) {
|
|
||||||
if (result == NETDEV_RESULT_ABORTED)
|
|
||||||
reply = dbus_error_aborted(device->connect_pending);
|
|
||||||
else
|
|
||||||
reply = dbus_error_failed(device->connect_pending);
|
|
||||||
|
|
||||||
dbus_pending_reply(&device->connect_pending, reply);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (device->state == DEVICE_STATE_CONNECTING)
|
|
||||||
device_disassociated(device);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (device->connect_pending) {
|
if (device->connect_pending) {
|
||||||
struct l_dbus_message *reply;
|
struct l_dbus_message *reply;
|
||||||
|
|
||||||
reply = l_dbus_message_new_method_return(
|
switch (result) {
|
||||||
|
case NETDEV_RESULT_ABORTED:
|
||||||
|
reply = dbus_error_aborted(device->connect_pending);
|
||||||
|
break;
|
||||||
|
case NETDEV_RESULT_OK:
|
||||||
|
reply = l_dbus_message_new_method_return(
|
||||||
device->connect_pending);
|
device->connect_pending);
|
||||||
l_dbus_message_set_arguments(reply, "");
|
l_dbus_message_set_arguments(reply, "");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reply = dbus_error_failed(device->connect_pending);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
dbus_pending_reply(&device->connect_pending, reply);
|
dbus_pending_reply(&device->connect_pending, reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result != NETDEV_RESULT_OK) {
|
||||||
|
device_disassociated(device);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
network_connected(device->connected_network);
|
network_connected(device->connected_network);
|
||||||
device_enter_state(device, DEVICE_STATE_CONNECTED);
|
device_enter_state(device, DEVICE_STATE_CONNECTED);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user