netdev: Add a NETDEV_RESULT_ABORTED

To be used so that the callback passed to netdev_connect can still
be called when the connection attempt is being aborted.
This commit is contained in:
Andrew Zaborowski 2016-07-26 14:42:21 +02:00 committed by Denis Kenzior
parent 3863f6d2bb
commit f76a86d2b0
2 changed files with 11 additions and 3 deletions

View File

@ -580,9 +580,16 @@ static void device_connect_cb(struct netdev *netdev, enum netdev_result result,
struct device *device = user_data;
if (result != NETDEV_RESULT_OK) {
if (device->connect_pending)
dbus_pending_reply(&device->connect_pending,
dbus_error_failed(device->connect_pending));
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);

View File

@ -32,6 +32,7 @@ enum netdev_result {
NETDEV_RESULT_ASSOCIATION_FAILED,
NETDEV_RESULT_HANDSHAKE_FAILED,
NETDEV_RESULT_KEY_SETTING_FAILED,
NETDEV_RESULT_ABORTED,
};
enum netdev_event {