summaryrefslogtreecommitdiff
path: root/android/hal-audio.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2014-07-18 12:48:17 +0300
committerSzymon Janc <szymon.janc@tieto.com>2014-07-18 13:41:22 +0200
commit2ed135a67acf953cc303938748eaf84fe0f6eda0 (patch)
tree6b8123bfc706cba4024c276fdcac5f3a1bba5276 /android/hal-audio.c
parentc1e035a30f6fa36b67cb74f3018e1c1980d6d4a9 (diff)
downloadbluez-2ed135a67acf953cc303938748eaf84fe0f6eda0.tar.gz
android/hal-audio: Fix leaving open socket
When getting out of the poll loop we shall close socket always.
Diffstat (limited to 'android/hal-audio.c')
-rw-r--r--android/hal-audio.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/android/hal-audio.c b/android/hal-audio.c
index 1a3d3ae4e..d7a06fa66 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -1377,14 +1377,12 @@ static void *ipc_handler(void *data)
/* Check if socket is still alive. Empty while loop.*/
while (poll(&pfd, 1, -1) < 0 && errno == EINTR);
- if (pfd.revents & (POLLHUP | POLLERR | POLLNVAL)) {
- info("Audio HAL: Socket closed");
+ info("Audio HAL: Socket closed");
- pthread_mutex_lock(&sk_mutex);
- close(audio_sk);
- audio_sk = -1;
- pthread_mutex_unlock(&sk_mutex);
- }
+ pthread_mutex_lock(&sk_mutex);
+ close(audio_sk);
+ audio_sk = -1;
+ pthread_mutex_unlock(&sk_mutex);
}
/* audio_sk is closed at this point, just cleanup endpoints states */