--- libaitrpc/src/cli.c 2012/03/29 01:34:16 1.8 +++ libaitrpc/src/cli.c 2012/05/14 08:39:05 1.9 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: cli.c,v 1.8 2012/03/29 01:34:16 misho Exp $ +* $Id: cli.c,v 1.9 2012/05/14 08:39:05 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -299,14 +299,13 @@ int 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) { - fd_set fds; u_char *buf; rpc_func_t func; struct tagRPCCall *rpc; int ret = 0, wlen = sizeof(struct tagRPCCall); - struct timeval tv = { DEF_RPC_TIMEOUT, 0 }; uint16_t tag, crc; uint32_t hash; + struct pollfd pfd; if (!cli || !csFunc) { rpc_SetErr(EINVAL, "Can`t execute call because parameter is null or invalid!"); @@ -377,9 +376,10 @@ rpc_cli_execCall(rpc_cli_t *cli, int noreply, const ch } /* reply from RPC server */ - FD_ZERO(&fds); - FD_SET(cli->cli_sock, &fds); - if ((ret = select(cli->cli_sock + 1, &fds, NULL, NULL, &tv)) < 1) { + pfd.fd = cli->cli_sock; + pfd.events = POLLIN | POLLPRI; + if ((ret = poll(&pfd, 1, DEF_RPC_TIMEOUT * 1000)) == -1 || + pfd.revents & (POLLERR | POLLHUP | POLLNVAL)) { if (ret) LOGERR; else