Fix overflowing for calling nanosleep() 88/181188/1
authorJunghoon Park <jh9216.park@samsung.com>
Mon, 11 Jun 2018 02:36:26 +0000 (11:36 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Mon, 11 Jun 2018 02:36:26 +0000 (11:36 +0900)
Change-Id: Id12e1e8512410046f9d3fb905ca6b4c363f0622b
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
src/port-internal.cc

index a88c9b0..23432aa 100644 (file)
@@ -35,7 +35,7 @@
 
 #define LOG_TAG "RPC_PORT"
 
-#define MAX_RETRY_CNT 15
+#define MAX_RETRY_CNT 18
 #define SEND_TIMEOUT 500
 
 namespace rpc_port {
@@ -74,6 +74,8 @@ int Port::Read(void* buf, unsigned int size) {
         retry_cnt++;
         nanosleep(&TRY_SLEEP_TIME, 0);
         TRY_SLEEP_TIME.tv_nsec *= 2;
+        if (TRY_SLEEP_TIME.tv_nsec > 999999999)
+          TRY_SLEEP_TIME.tv_nsec = 999999999;
         continue;
       }
       LOGE("read_socket: ...error fd %d: errno %d\n", fd_, errno);