version 1.8, 2012/03/29 01:34:16
|
version 1.9, 2012/05/14 08:39:05
|
Line 299 int
|
Line 299 int
|
rpc_cli_execCall(rpc_cli_t *cli, int noreply, const char *csModule, const char *csFunc, |
rpc_cli_execCall(rpc_cli_t *cli, int noreply, const char *csModule, const char *csFunc, |
array_t * __restrict in_vars, array_t ** __restrict out_vars) |
array_t * __restrict in_vars, array_t ** __restrict out_vars) |
{ |
{ |
fd_set fds; |
|
u_char *buf; |
u_char *buf; |
rpc_func_t func; |
rpc_func_t func; |
struct tagRPCCall *rpc; |
struct tagRPCCall *rpc; |
int ret = 0, wlen = sizeof(struct tagRPCCall); |
int ret = 0, wlen = sizeof(struct tagRPCCall); |
struct timeval tv = { DEF_RPC_TIMEOUT, 0 }; |
|
uint16_t tag, crc; |
uint16_t tag, crc; |
uint32_t hash; |
uint32_t hash; |
|
struct pollfd pfd; |
|
|
if (!cli || !csFunc) { |
if (!cli || !csFunc) { |
rpc_SetErr(EINVAL, "Can`t execute call because parameter is null or invalid!"); |
rpc_SetErr(EINVAL, "Can`t execute call because parameter is null or invalid!"); |
Line 377 rpc_cli_execCall(rpc_cli_t *cli, int noreply, const ch
|
Line 376 rpc_cli_execCall(rpc_cli_t *cli, int noreply, const ch
|
} |
} |
|
|
/* reply from RPC server */ |
/* reply from RPC server */ |
FD_ZERO(&fds); | pfd.fd = cli->cli_sock; |
FD_SET(cli->cli_sock, &fds); | pfd.events = POLLIN | POLLPRI; |
if ((ret = select(cli->cli_sock + 1, &fds, NULL, NULL, &tv)) < 1) { | if ((ret = poll(&pfd, 1, DEF_RPC_TIMEOUT * 1000)) == -1 || |
| pfd.revents & (POLLERR | POLLHUP | POLLNVAL)) { |
if (ret) |
if (ret) |
LOGERR; |
LOGERR; |
else |
else |