Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH 4/5] android/hal: Use notification socket for daemon lifetime tracking
Date: Tue, 22 Oct 2013 15:24:58 +0200	[thread overview]
Message-ID: <1382448299-16887-4-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1382448299-16887-1-git-send-email-szymon.janc@tieto.com>

If daemon exited unexpectedly HAL should be stop. With cleanup
procedure command socket is closed as first so use that to distinguish
correct action.
---
 android/hal-ipc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index 16f2bd3..f753f10 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -88,8 +88,13 @@ static void *notification_handler(void *data)
 		}
 
 		/* socket was shutdown */
-		if (ret == 0)
-			break;
+		if (ret == 0) {
+			if (cmd_sk == -1)
+				break;
+
+			error("Notification socket closed, aborting");
+			exit(EXIT_FAILURE);
+		}
 
 		if (ret < (ssize_t) sizeof(*hal_msg)) {
 			error("Too small notification (%zd bytes), aborting",
-- 
1.8.4


  parent reply	other threads:[~2013-10-22 13:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 13:24 [PATCH 1/5] android/hal: Unify HALs callbacks pointers definition Szymon Janc
2013-10-22 13:24 ` [PATCH 2/5] adapter/hal: Implement adapter enable call Szymon Janc
2013-10-22 13:24 ` [PATCH 3/5] adapter/hal: Implement adapter disable call Szymon Janc
2013-10-22 13:24 ` Szymon Janc [this message]
2013-10-22 13:24 ` [PATCH 5/5] android: Remove not needed include Szymon Janc
2013-10-22 14:19 ` [PATCH 1/5] android/hal: Unify HALs callbacks pointers definition Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382448299-16887-4-git-send-email-szymon.janc@tieto.com \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox