Fix Receive 09/310009/2
authorIlho Kim <ilho159.kim@samsung.com>
Fri, 19 Apr 2024 05:14:36 +0000 (14:14 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Fri, 19 Apr 2024 06:00:10 +0000 (15:00 +0900)
After returning the EINTR in the first read, even if the read is successful
it regarded as the EINTR case and continue loop

Change-Id: Ia7cfa4cf60c7131b63d5a782ebf5e2b719e3c6c5
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
(cherry picked from commit d83c74a93e1c5f77da5a8b3ecd735629af42ccf3)

src/client-socket-internal.cc

index 131984802c9aea8b0808772e5e7e87b5152c6a9b..b19e64360765a1395a683a6843dabb49fc30431f 100644 (file)
@@ -109,13 +109,14 @@ int ClientSocket::Receive(void* buf, unsigned int size) {
       return -EIO;
     }
 
-    if (errno == EINTR) {
-      usleep(100 * 1000);
-      continue;
-    }
+    if (bytes < 0) {
+      if (errno == EINTR) {
+        usleep(100 * 1000);
+        continue;
+      }
 
-    if (bytes < 0)
       return -errno;
+    }
 
     len -= bytes;
     buffer += bytes;