From eaecd30476c718c432f6cc3be065b16a311e49a3 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sat, 4 Oct 2014 22:22:46 +0200 Subject: RIL client open retry at RIL init Signed-off-by: Paul Kocialkowski --- samsung-ril.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/samsung-ril.c b/samsung-ril.c index 5b191fd..8174e72 100644 --- a/samsung-ril.c +++ b/samsung-ril.c @@ -1462,6 +1462,7 @@ const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, { RIL_RadioFunctions *radio_functions; pthread_attr_t attr; + int failures; unsigned int i; int rc; @@ -1491,7 +1492,16 @@ const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, if (ril_clients[i] == NULL) continue; - rc = ril_client_open(ril_clients[i]); + failures = 0; + + do { + rc = ril_client_open(ril_clients[i]); + if (rc < 0) { + failures++; + usleep(RIL_CLIENT_RETRY_DELAY); + } + } while (rc < 0 && failures < RIL_CLIENT_RETRY_COUNT); + if (rc < 0) goto error; -- cgit v1.1