summaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-10-31 20:30:16 +0100
committerDaniel Wagner <wagi@monom.org>2011-10-31 20:33:09 +0100
commitf8f47e8bbcdf564a024241c1b24cc0a723bcf1d9 (patch)
treec5e89fc02510980b8a8a501a1330c69279adf24f /src/device.c
parentd3c40382d9a8de807dd8ba9a2bfe131a5aa46a32 (diff)
downloadconnman-f8f47e8bbcdf564a024241c1b24cc0a723bcf1d9.tar.gz
connman-f8f47e8bbcdf564a024241c1b24cc0a723bcf1d9.tar.bz2
connman-f8f47e8bbcdf564a024241c1b24cc0a723bcf1d9.zip
device: Cancel pending trigger when device is removed
connmand[28326]: src/device.c:device_destruct() device 0x6b97c0 name candlejack.bmw-carit.intra-1 connmand[28326]: plugins/bluetooth.c:powered_reply() connmand[28326]: Name "org.bluez" does not exist connmand[28326]: src/device.c:device_pending_reset() device 0x6b97c0
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/device.c b/src/device.c
index fedd5810..9ba7caf7 100644
--- a/src/device.c
+++ b/src/device.c
@@ -96,6 +96,14 @@ static void clear_scan_trigger(struct connman_device *device)
}
}
+static void clear_pending_trigger(struct connman_device *device)
+{
+ if (device->pending_timeout > 0) {
+ g_source_remove(device->pending_timeout);
+ device->pending_timeout = 0;
+ }
+}
+
static void reset_scan_trigger(struct connman_device *device)
{
clear_scan_trigger(device);
@@ -438,6 +446,7 @@ static void device_destruct(struct connman_device *device)
{
DBG("device %p name %s", device, device->name);
+ clear_pending_trigger(device);
clear_scan_trigger(device);
g_free(device->ident);
@@ -663,11 +672,7 @@ int connman_device_set_powered(struct connman_device *device,
if (device->powered == powered)
return -EALREADY;
- if (device->pending_timeout) {
- /* Reset pending request */
- g_source_remove(device->pending_timeout);
- device->pending_timeout = 0;
- }
+ clear_pending_trigger(device);
device->powered_pending = PENDING_NONE;