Retry read() when getting EAGAIN 33/270633/1 accepted/tizen/unified/20220210.105947 submit/tizen/20220208.033954 submit/tizen/20220210.054535
authorSeonah Moon <seonah1.moon@samsung.com>
Mon, 7 Feb 2022 05:50:25 +0000 (14:50 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Mon, 7 Feb 2022 05:50:34 +0000 (14:50 +0900)
When download is requested from new client, client DB including several tables is created.
This often takes long time on RPI4 and makes IPC error(EAGAIN) in the end.

Change-Id: Ib28dcc22e929d11fe61e5f1690f7da64ee5465b8

packaging/download-provider.spec
provider/download-provider-ipc.c

index 7494d34..cda6917 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       download-provider
 Summary:    Download the contents in background
-Version:    2.3.1
+Version:    2.3.2
 Release:    0
 Group:      Development/Libraries
 License:    Apache-2.0
index dfe587e..d1e8eea 100644 (file)
@@ -101,7 +101,7 @@ dp_ipc_fmt *dp_ipc_get_fmt(int sock)
        memset(ipc_info, 0x00, sizeof(dp_ipc_fmt));
 
        int errorcode = DP_ERROR_NONE;
-       int tryagain = 3;
+       int tryagain = 5;
 
        do {
                ssize_t recv_size = read(sock, ipc_info, sizeof(dp_ipc_fmt));
@@ -111,7 +111,8 @@ dp_ipc_fmt *dp_ipc_get_fmt(int sock)
                } else {
                        errorcode = DP_ERROR_NONE;
                }
-       } while (sock >= 0 && (errorcode == DP_ERROR_IO_EINTR) && (--tryagain > 0));
+       } while (sock >= 0 && (errorcode == DP_ERROR_IO_EAGAIN ||
+               errorcode == DP_ERROR_IO_EINTR) && (--tryagain > 0));
 
        if (errorcode != DP_ERROR_NONE) {
                TRACE_ERROR("Failed to read sock[%d]", sock);