Thread (13 messages) flat view 13 messages, 2 authors, 2011-10-20
STALE5418d

[PATCH 7/8] Manage watcher's disconnections from the bus

From: Santiago Carot-Nemesio <hidden>
Date: 2011-10-20 09:46:50
Subsystem: the rest · Maintainer: Linus Torvalds

---
 thermometer/thermometer.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 9b14e6f..4a2b9c8 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -560,7 +560,16 @@ static void disable_final_measurement(struct thermometer *t)
 
 static void watcher_exit(DBusConnection *conn, void *user_data)
 {
-	/* TODO: Watcher disconnected */
+	struct watcher *watcher = user_data;
+	struct thermometer *t = watcher->t;
+
+	DBG("Thermometer watcher %s disconnected", watcher->path);
+
+	t->fwatchers = g_slist_remove(t->fwatchers, watcher);
+	watcher->id = 0;
+
+	if (g_slist_length(t->fwatchers) == 0)
+		disable_final_measurement(t);
 }
 
 static struct watcher *find_watcher(struct thermometer *t, const gchar *sender,
-- 
1.7.6.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help