--- libaitrpc/src/blob.c 2012/03/29 01:34:16 1.6 +++ libaitrpc/src/blob.c 2012/05/11 09:18:13 1.6.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: blob.c,v 1.6 2012/03/29 01:34:16 misho Exp $ +* $Id: blob.c,v 1.6.2.1 2012/05/11 09:18:13 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -247,20 +247,18 @@ rpc_srv_recvBLOB(rpc_cli_t * __restrict cli, rpc_blob_ { int ret, len; uint8_t *pos; - fd_set fds; - struct timeval tv = { DEF_RPC_TIMEOUT, 0 }; + struct pollfd pfd; if (!cli || !blob || !blob->blob_data) { rpc_SetErr(EINVAL, "Invalid arguments"); return -1; - } else - tv.tv_sec = ((rpc_sess_t*) cli->cli_parent)->sess_timeout; + } + pfd.fd = cli->cli_sock; + pfd.events = POLLIN | POLLPRI; for (ret = blob->blob_len, pos = blob->blob_data; ret > 0; ret -= len, pos += len) { - FD_ZERO(&fds); - FD_SET(cli->cli_sock, &fds); - len = select(cli->cli_sock + 1, &fds, NULL, NULL, &tv); - if (len < 1) { + if ((len = poll(&pfd, 1, ((rpc_sess_t*) cli->cli_parent)->sess_timeout * 1000)) == -1 || + pfd.revents & (POLLERR | POLLHUP | POLLNVAL)) { LOGERR; return -1; }