From 8ac0b194aae25b980c2822901edebe8e9d006c9a Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Tue, 15 Nov 2011 12:59:15 +0100 Subject: [PATCH] adapter: Remove all targets when starting a poll --- src/adapter.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index 7c968cb..0439237 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -245,6 +245,13 @@ static DBusMessage *start_poll(DBusConnection *conn, DBG("conn %p", conn); + if (g_hash_table_size(adapter->targets) > 0) { + DBG("Clearing targets"); + + g_hash_table_remove_all(adapter->targets); + __near_adapter_target_changed(adapter->idx); + } + err = __near_netlink_start_poll(adapter->idx, adapter->protocols); if (err < 0) return __near_error_failed(msg, -err); @@ -413,6 +420,8 @@ int __near_adapter_remove_target(uint32_t idx, uint32_t target_idx) g_hash_table_remove(adapter->targets, GINT_TO_POINTER(target_idx)); + __near_adapter_target_changed(idx); + return 0; } -- 2.7.4