[Feature][ZXW-33]merge ZXW 0428 version
Change-Id: I11f167edfea428d9fab198ff00ff1364932d1b0b
diff --git a/ap/app/zte_comm/nvserver/sc_rpc.c b/ap/app/zte_comm/nvserver/sc_rpc.c
index eddf7b5..c741601 100755
--- a/ap/app/zte_comm/nvserver/sc_rpc.c
+++ b/ap/app/zte_comm/nvserver/sc_rpc.c
@@ -144,8 +144,43 @@
return 0;
}
-int sc_rpc_recv(int fd, T_sc_rpc_header *data, unsigned int flag)
+int sc_rpc_recv(int fd, T_sc_rpc_header *data, unsigned int timeout)
{
+#if 1
+ fd_set readfds;
+ ssize_t len;
+ int ret;
+ struct timeval timeout_t = {timeout, 0};
+ int errNo = 0;
+
+ FD_ZERO(&readfds);
+ FD_SET(fd, &readfds);
+
+ //ret = select(fd + 1, &readfds, NULL, NULL, &timeout_t);
+ do {
+ ret = select(fd + 1, &readfds, NULL, NULL, &timeout_t);
+ } while (ret < 0 && errno == EINTR);
+
+ if (ret == 0)
+ {
+ printf("[error] nvrpc select timeout!\n");
+ return -1;
+ }
+ else if(ret < 0)
+ {
+ printf("[error] nvrpc ret:%d\n", ret);
+ return -2;
+ }
+
+ len = full_read(fd, data, sizeof(T_sc_rpc_header));
+ if (len != sizeof(T_sc_rpc_header))
+ {
+ printf("[nvrpc] read error, len=%d != %d!\n", len, (int)sizeof(T_sc_rpc_header));
+ return -3;
+ }
+
+ return 0;
+#else
ssize_t ret;
ret = full_read(fd, data, sizeof(T_sc_rpc_header));
@@ -156,6 +191,7 @@
}
return 0;
+#endif
}
int sc_rpc_close(int fd)