diff mbox

[09/23] adapter: Clear timeout handle when check presence timer stopped

Message ID 20170615182516.4508-10-mgreer@animalcreek.com (mailing list archive)
State Accepted
Delegated to: Samuel Ortiz
Headers show

Commit Message

Mark Greer June 15, 2017, 6:25 p.m. UTC
__near_adapter_stop_check_presence() stops the neard check presence
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 <mgreer@animalcreek.com>
---
 src/adapter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/src/adapter.c b/src/adapter.c
index 466753b..7be87e2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -505,8 +505,10 @@  void __near_adapter_stop_check_presence(uint32_t adapter_idx,
 	if (!adapter)
 		return;
 
-	if (adapter->presence_timeout > 0)
+	if (adapter->presence_timeout > 0) {
 		g_source_remove(adapter->presence_timeout);
+		adapter->presence_timeout = 0;
+	}
 }
 
 static const GDBusMethodTable adapter_methods[] = {