diff --git a/src/device.c b/src/device.c index 2bc64c63..e86d8cf6 100644 --- a/src/device.c +++ b/src/device.c @@ -81,24 +81,6 @@ static bool device_is_busy(struct device *device) return station_is_busy(device->station); } -static void device_disconnect_event(struct device *device) -{ - struct station *station = device->station; - - l_debug("%d", device->index); - - if (station->connect_pending) { - struct network *network = station->connected_network; - - dbus_pending_reply(&station->connect_pending, - dbus_error_failed(station->connect_pending)); - - network_connect_failed(network); - } - - station_disassociated(station); -} - static void device_reassociate_cb(struct netdev *netdev, enum netdev_result result, void *user_data) @@ -417,7 +399,7 @@ static void device_netdev_event(struct netdev *netdev, enum netdev_event event, break; case NETDEV_EVENT_DISCONNECT_BY_AP: case NETDEV_EVENT_DISCONNECT_BY_SME: - device_disconnect_event(device); + station_disconnect_event(station); break; case NETDEV_EVENT_RSSI_THRESHOLD_LOW: station_low_rssi(station); diff --git a/src/station.c b/src/station.c index 9764e87a..df19fd16 100644 --- a/src/station.c +++ b/src/station.c @@ -717,6 +717,22 @@ void station_disassociated(struct station *station) station_enter_state(station, STATION_STATE_AUTOCONNECT); } +void station_disconnect_event(struct station *station) +{ + l_debug("%u", netdev_get_ifindex(station->netdev)); + + if (station->connect_pending) { + struct network *network = station->connected_network; + + dbus_pending_reply(&station->connect_pending, + dbus_error_failed(station->connect_pending)); + + network_connect_failed(network); + } + + station_disassociated(station); +} + static void station_roam_timeout_rearm(struct station *station, int seconds); void station_roamed(struct station *station) diff --git a/src/station.h b/src/station.h index 443062be..4debb9a9 100644 --- a/src/station.h +++ b/src/station.h @@ -109,6 +109,7 @@ void station_low_rssi(struct station *station); void station_ok_rssi(struct station *station); void station_disassociated(struct station *station); +void station_disconnect_event(struct station *station); struct l_dbus_message *station_dbus_connect_hidden_network( struct l_dbus *dbus,