--- libaitrpc/src/blob.c 2012/05/16 13:32:47 1.7.2.5 +++ libaitrpc/src/blob.c 2012/05/17 15:14:16 1.7.2.7 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: blob.c,v 1.7.2.5 2012/05/16 13:32:47 misho Exp $ +* $Id: blob.c,v 1.7.2.7 2012/05/17 15:14:16 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -247,7 +247,10 @@ rpc_srv_recvBLOB(rpc_cli_t * __restrict cli, rpc_blob_ for (ret = blob->blob_len, pos = blob->blob_data; ret > 0; ret -= len, pos += len) { if ((len = poll(&pfd, 1, DEF_RPC_TIMEOUT * 1000)) < 1 || pfd.revents & (POLLERR | POLLHUP | POLLNVAL)) { - LOGERR; + if (len) + LOGERR; + else + rpc_SetErr(ETIMEDOUT, "Timeout reached! Server not respond"); return -1; } @@ -282,7 +285,8 @@ rpc_cli_sendBLOB(rpc_cli_t * __restrict cli, ait_val_t if (!cli || !var || !data) { rpc_SetErr(EINVAL, "Invalid arguments"); return -1; - } + } else + memset(&hdr, 0, sizeof hdr); rpc_addPktSession(&hdr.hdr_session, cli->cli_parent); hdr.hdr_cmd = set; @@ -366,8 +370,10 @@ rpc_cli_recvBLOB(rpc_cli_t * __restrict cli, ait_val_t if (!*data) { LOGERR; return -1; - } else + } else { + memset(&hdr, 0, sizeof hdr); memset(*data, 0, AIT_LEN(var)); + } rpc_addPktSession(&hdr.hdr_session, cli->cli_parent); hdr.hdr_cmd = get; @@ -461,7 +467,8 @@ rpc_cli_delBLOB(rpc_cli_t * __restrict cli, ait_val_t if (!cli || !var) { rpc_SetErr(EINVAL, "Invalid arguments"); return -1; - } + } else + memset(&hdr, 0, sizeof hdr); rpc_addPktSession(&hdr.hdr_session, cli->cli_parent); hdr.hdr_cmd = unset;