diff options
author | Basil Gello <vasek.gello@gmail.com> | 2017-07-18 22:00:01 +0300 |
---|---|---|
committer | Christopher N. Hesse <raymanfx@gmail.com> | 2017-08-03 21:03:38 +0000 |
commit | 2a40024127ef9af9c2633f07da93542ec570d181 (patch) | |
tree | b90d4bb22735be709d75443df92c41d4c95fd964 | |
parent | fb5669e851ba8e534fcf59ae36cd6228edaed35b (diff) | |
download | android_hardware_samsung-2a40024127ef9af9c2633f07da93542ec570d181.tar.gz android_hardware_samsung-2a40024127ef9af9c2633f07da93542ec570d181.tar.bz2 android_hardware_samsung-2a40024127ef9af9c2633f07da93542ec570d181.zip |
secril-client: close fds on I/O errors
if a kernel device returns an I/O error, it is better not to chew
the CPU resources retrying I/O operation on a not ready device.
Fixes periodical 100%-core load in audioserver after a voice call
completion.
Change-Id: I2b66ffd18c85823a11e50598a6b4e3c0245a0083
-rwxr-xr-x | ril/libsecril-client/secril-client.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ril/libsecril-client/secril-client.cpp b/ril/libsecril-client/secril-client.cpp index a0bf078..e607f00 100755 --- a/ril/libsecril-client/secril-client.cpp +++ b/ril/libsecril-client/secril-client.cpp @@ -1141,6 +1141,12 @@ error: FreeToken(&(client_prv->token_pool), token); ClearReqHistory(client_prv, token); + if (ret == -EPIPE || ret == -EBADFD) { + close(client_prv->sock); + client_prv->sock = -1; + client_prv->b_connect = 0; + } + return RIL_CLIENT_ERR_UNKNOWN; } @@ -1298,6 +1304,23 @@ static void * RxReaderFunc(void *param) { client_prv->b_connect = 0; } } + } else { + RLOGE("%s: select() returned %d\n", __FUNCTION__, -errno); + + if (client_prv->sock > 0) { + close(client_prv->sock); + client_prv->sock = -1; + client_prv->b_connect = 0; + } + + if (client_prv->p_rs) + record_stream_free(client_prv->p_rs); + + // EOS + if (client_prv->err_cb) { + client_prv->err_cb(client_prv->err_cb_data, RIL_CLIENT_ERR_CONNECT); + return NULL; + } } } |