Re: [RFC] android/hal-audio: Fix leaving open socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andrei,

On Thu, Jun 5, 2014 at 3:31 PM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@xxxxxxxxx> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>
>
> When getting out of the poll loop we shall close socket always.
> ---
>  android/hal-audio.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/android/hal-audio.c b/android/hal-audio.c
> index bfc102f..439b583 100644
> --- a/android/hal-audio.c
> +++ b/android/hal-audio.c
> @@ -1346,14 +1346,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 */
> --
> 1.8.3.2

Im not quite sure what this does fix, I mean I do understand that the
if statement might not be required after all we have since we have
pfd.events = POLLHUP | POLLERR | POLLNVAL but removing it is not a fix
more a cleanup.


-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux