--- libaitrpc/src/cli.c 2013/08/22 12:11:35 1.16.8.5 +++ libaitrpc/src/cli.c 2013/08/22 14:01:00 1.16.8.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: cli.c,v 1.16.8.5 2013/08/22 12:11:35 misho Exp $ +* $Id: cli.c,v 1.16.8.6 2013/08/22 14:01:00 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -357,6 +357,9 @@ payload: if (type == SOCK_STREAM) { memset(buf, 0, blen); ret = recv(sock, buf, blen, 0); + /* handling case for reply without payload */ + if (!ret && buf != AIT_GET_BUF(pkt)) + return (buf - AIT_GET_BUF(pkt)); } else { blen = AIT_LEN(pkt); memset(buf, 0, blen); @@ -391,11 +394,11 @@ payload: /* calc estimated length */ rpc = (struct tagRPCCall*) buf; - estlen = ntohl(rpc->call_len) + blen; + estlen = ntohl(rpc->call_len); if (estlen > AIT_LEN(pkt)) AIT_RE_BUF(pkt, estlen); buf = AIT_GET_BUF(pkt) + blen; - blen = AIT_LEN(pkt) - blen; + blen = estlen - blen; goto payload; } else ret += sizeof(struct tagRPCCall);