From 99bd2669f14c4a245fa91b6282669424ab67ed43 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Mon, 21 Oct 2013 20:56:44 +0200 Subject: [PATCH] android: Split command and notification socket watch --- android/main.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/android/main.c b/android/main.c index fac10034f..b24451e45 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) { -- 2.47.3