[Feature][ZXW-65]merged P49 base code
Change-Id: I3e09c0c3d47483bc645f02310380ecb7fc6f4041
diff --git a/ap/app/zte_comm/nvserver/sc_rpc.c b/ap/app/zte_comm/nvserver/sc_rpc.c
index c741601..283db4f 100755
--- a/ap/app/zte_comm/nvserver/sc_rpc.c
+++ b/ap/app/zte_comm/nvserver/sc_rpc.c
@@ -38,7 +38,7 @@
/*******************************************************************************
* 宏定义 *
*******************************************************************************/
-#define RPC_CHN_MAX_BUF_LEN 8192
+#define RPC_CHN_MAX_BUF_LEN 18432
/*******************************************************************************
* 数据类型定义 *
@@ -130,21 +130,22 @@
return 0;
}
-int sc_rpc_send(int fd, T_sc_rpc_header *data, unsigned int flag)
+int sc_rpc_send(int fd, T_sc_rpc_msg *data, unsigned int flag)
{
ssize_t ret;
-
- ret = full_write(fd, data, sizeof(T_sc_rpc_header));
- if (ret != sizeof(T_sc_rpc_header))
+ T_sc_rpc_header *header = (T_sc_rpc_header *)data;
+
+ ret = full_write(fd, data, sizeof(T_sc_rpc_header) + header->data_len);
+ if (ret != sizeof(T_sc_rpc_header) + header->data_len)
{
- printf("[rpc] write error, len=%d != %d!\n", ret, (int)sizeof(T_sc_rpc_header));
+ printf("[rpc] write error, len=%d != %d!\n", ret, (int)sizeof(T_sc_rpc_header)+ header->data_len);
return -1;
}
return 0;
}
-int sc_rpc_recv(int fd, T_sc_rpc_header *data, unsigned int timeout)
+int sc_rpc_recv(int fd, T_sc_rpc_msg *data, unsigned int timeout)
{
#if 1
fd_set readfds;
@@ -152,7 +153,8 @@
int ret;
struct timeval timeout_t = {timeout, 0};
int errNo = 0;
-
+ T_sc_rpc_header *header = 0;
+
FD_ZERO(&readfds);
FD_SET(fd, &readfds);
@@ -172,10 +174,11 @@
return -2;
}
- len = full_read(fd, data, sizeof(T_sc_rpc_header));
- if (len != sizeof(T_sc_rpc_header))
+ len = safe_read(fd, data, sizeof(T_sc_rpc_msg));
+ header = (T_sc_rpc_header *)data;
+ if (len != sizeof(T_sc_rpc_header)+ header->data_len)
{
- printf("[nvrpc] read error, len=%d != %d!\n", len, (int)sizeof(T_sc_rpc_header));
+ printf("[nvrpc] read error, len=%d != %d!\n", len, (int)sizeof(T_sc_rpc_header)+ header->data_len);
return -3;
}