Diff between e28c3072bd85b18caaadfebc276d280e47e1c3d8 and 99bd2669f14c4a245fa91b6282669424ab67ed43

Changed Files

File Additions Deletions Status
android/main.c +13 -4 modified

Full Patch

diff --git a/android/main.c b/android/main.c
index fac1003..b24451e 100644
--- a/android/main.c
+++ b/android/main.c
@@ -62,10 +62,19 @@ static GIOChannel *hal_notif_io = NULL;
 
 static volatile sig_atomic_t __terminated = 0;
 
-static gboolean watch_cb(GIOChannel *io, GIOCondition cond,
+static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond,
 							gpointer user_data)
 {
-	info("HAL socket closed, terminating");
+	info("HAL command socket closed, terminating");
+	g_main_loop_quit(event_loop);
+
+	return FALSE;
+}
+
+static gboolean notif_watch_cb(GIOChannel *io, GIOCondition cond,
+							gpointer user_data)
+{
+	info("HAL notification socket closed, terminating");
 	g_main_loop_quit(event_loop);
 
 	return FALSE;
@@ -123,7 +132,7 @@ static gboolean notif_connect_cb(GIOChannel *io, GIOCondition cond,
 
 	cond = G_IO_ERR | G_IO_HUP | G_IO_NVAL;
 
-	g_io_add_watch(io, cond, watch_cb, NULL);
+	g_io_add_watch(io, cond, notif_watch_cb, NULL);
 
 	info("Successfully connected to HAL");
 
@@ -144,7 +153,7 @@ static gboolean cmd_connect_cb(GIOChannel *io, GIOCondition cond,
 
 	cond = G_IO_ERR | G_IO_HUP | G_IO_NVAL;
 
-	g_io_add_watch(io, cond, watch_cb, NULL);
+	g_io_add_watch(io, cond, cmd_watch_cb, NULL);
 
 	hal_notif_io = connect_hal(notif_connect_cb);
 	if (!hal_notif_io) {