From 65dc6a1f80f72c63df58e0541178c8442132c122 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 23 Jul 2009 09:24:30 +0200 Subject: [PATCH] Fix rearming the scan trigger if a device got disabled --- src/device.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/device.c b/src/device.c index 48aca8b..0e94999 100644 --- a/src/device.c +++ b/src/device.c @@ -86,12 +86,17 @@ static gboolean device_scan_trigger(gpointer user_data) return TRUE; } -static void reset_scan_trigger(struct connman_device *device) +static void clear_scan_trigger(struct connman_device *device) { if (device->scan_timeout > 0) { g_source_remove(device->scan_timeout); device->scan_timeout = 0; } +} + +static void reset_scan_trigger(struct connman_device *device) +{ + clear_scan_trigger(device); if (device->scan_interval > 0) { guint interval = device->scan_interval; @@ -312,6 +317,8 @@ static int set_powered(struct connman_device *device, connman_bool_t powered) } else err = -EINVAL; } else { + clear_scan_trigger(device); + g_hash_table_remove_all(device->networks); set_carrier(device, FALSE); @@ -1304,6 +1311,8 @@ int __connman_device_disable(struct connman_device *device) if (device->powered == FALSE) return -ENOLINK; + clear_scan_trigger(device); + g_hash_table_remove_all(device->networks); err = device->driver->disable(device); -- 2.7.4