Fix retry sleep time 69/173269/3
authorInkyun Kil <inkyun.kil@samsung.com>
Tue, 20 Mar 2018 06:40:27 +0000 (15:40 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Tue, 20 Mar 2018 08:42:45 +0000 (08:42 +0000)
Change-Id: I40a4dc15e6f2a7250d981244673b5951bf43280e
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
src/port-internal.cc

index f69ff24..8049fef 100644 (file)
@@ -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<char*>(buf);
   std::lock_guard<std::recursive_mutex> 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);