__near_adapter_set_dep_state() stops the neard DEP timer but
doesn't clear the timer handle.  This can cause neard to try
to stop the timer when it isn't running.  To fix that, clear
the handle so neard doesn't try to stop an already stopped timer.

Signed-off-by: Mark Greer <mgr...@animalcreek.com>
---
 src/adapter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index 7be87e2..eb1a407 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -615,8 +615,10 @@ int __near_adapter_set_dep_state(uint32_t idx, bool dep)
                target_idx =  __neard_device_get_idx(adapter->device_link);
                __near_adapter_remove_target(idx, target_idx);
        } else {
-               if (adapter->dep_timer > 0)
+               if (adapter->dep_timer > 0) {
                        g_source_remove(adapter->dep_timer);
+                       adapter->dep_timer = 0;
+               }
 
                if (!__near_device_register_interface(adapter->device_link))
                        return -ENODEV;
-- 
2.13.0

Reply via email to