diff options
author | Nitin Srivastav <nitinsr@codeaurora.org> | 2014-02-21 18:33:14 +0530 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2014-05-06 01:14:24 -0700 |
commit | 1b1708919d25b5b58384a590f8258f099c97a81f (patch) | |
tree | b7aa9dbc66f8ffc60625bbdef004ce0821ddf3cf /audio_a2dp_hw | |
parent | fc07218666349142c0de3b461921b8cda792aa76 (diff) | |
download | android_system_bt-1b1708919d25b5b58384a590f8258f099c97a81f.tar.gz android_system_bt-1b1708919d25b5b58384a590f8258f099c97a81f.tar.bz2 android_system_bt-1b1708919d25b5b58384a590f8258f099c97a81f.zip |
Bluetooth: retry recv in case of EINTR
- retry recv call in HAL, in case socket call
fails with EINTR
Change-Id: I3ab27752b0ce0a68f6776cf5da340580e7d1f345
Diffstat (limited to 'audio_a2dp_hw')
-rw-r--r-- | audio_a2dp_hw/audio_a2dp_hw.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/audio_a2dp_hw/audio_a2dp_hw.c b/audio_a2dp_hw/audio_a2dp_hw.c index a3614992f..10432f1a6 100644 --- a/audio_a2dp_hw/audio_a2dp_hw.c +++ b/audio_a2dp_hw/audio_a2dp_hw.c @@ -286,9 +286,24 @@ static int a2dp_command(struct a2dp_stream_out *out, char cmd) if (recv(out->ctrl_fd, &ack, 1, MSG_NOSIGNAL) < 0) { ERROR("ack failed (%s)", strerror(errno)); - skt_disconnect(out->ctrl_fd); - out->ctrl_fd = AUDIO_SKT_DISCONNECTED; - return -1; + if (errno == EINTR) + { + /* retry again */ + if (recv(out->ctrl_fd, &ack, 1, MSG_NOSIGNAL) < 0) + { + ERROR("ack failed (%s)", strerror(errno)); + skt_disconnect(out->ctrl_fd); + out->ctrl_fd = AUDIO_SKT_DISCONNECTED; + return -1; + } + } + else + { + skt_disconnect(out->ctrl_fd); + out->ctrl_fd = AUDIO_SKT_DISCONNECTED; + return -1; + + } } DEBUG("A2DP COMMAND %s DONE STATUS %d", dump_a2dp_ctrl_event(cmd), ack); |