From 04a9d4159f0b7cb6f95a0d5db9eb83b418044741 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Tue, 20 Mar 2018 15:40:27 +0900 Subject: [PATCH] Fix retry sleep time Change-Id: I40a4dc15e6f2a7250d981244673b5951bf43280e Signed-off-by: Inkyun Kil --- src/port-internal.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/port-internal.cc b/src/port-internal.cc index f69ff24..8049fef 100644 --- a/src/port-internal.cc +++ b/src/port-internal.cc @@ -58,7 +58,7 @@ int Port::Read(void* buf, unsigned int size) { unsigned int left = size; ssize_t nb; int retry_cnt = 0; - const struct timespec TRY_SLEEP_TIME = { 0, 500 * 1000 * 1000 }; + struct timespec TRY_SLEEP_TIME = { 0, 5 * 1000 * 1000 }; int bytes_read = 0; char* buffer = static_cast(buf); std::lock_guard lock(mutex_); @@ -73,6 +73,7 @@ int Port::Read(void* buf, unsigned int size) { LOGE("read_socket: %d errno, sleep and retry ...", errno); retry_cnt++; nanosleep(&TRY_SLEEP_TIME, 0); + TRY_SLEEP_TIME.tv_nsec *= 2; continue; } LOGE("read_socket: ...error fd %d: errno %d\n", fd_, errno); -- 2.7.4