--- libaitrpc/src/srv.c 2013/08/22 13:09:53 1.17.6.3 +++ libaitrpc/src/srv.c 2013/08/22 13:13:16 1.17.6.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: srv.c,v 1.17.6.3 2013/08/22 13:09:53 misho Exp $ +* $Id: srv.c,v 1.17.6.4 2013/08/22 13:13:16 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -380,7 +380,7 @@ txUDPPacket(sched_task_t *task) rpc_cli_t *c = TASK_ARG(task); rpc_srv_t *s = c->cli_parent; rpc_func_t *f = NULL; - u_char buf[USHRT_MAX] = { 0 }; + u_char *buf = AIT_GET_BUF(&c->cli_buf); struct tagRPCCall *rpc = (struct tagRPCCall*) buf; int ret, wlen = sizeof(struct tagRPCCall); struct timespec ts = { DEF_RPC_TIMEOUT, 0 }; @@ -389,9 +389,6 @@ txUDPPacket(sched_task_t *task) schedTimer(TASK_ROOT(task), cbProto[s->srv_proto][CB_CLOSECLIENT], TASK_ARG(task), ts, TASK_ARG(task), 0); - /* copy RPC header */ - memcpy(buf, TASK_DATA(task), wlen); - if (rpc->call_argc) { f = rpc_srv_getCall(s, ntohs(rpc->call_tag)); if (!f) { @@ -402,7 +399,8 @@ txUDPPacket(sched_task_t *task) } else { rpc->call_argc = htons(array_Size(RPC_RETVARS(c))); /* Go Encapsulate variables */ - ret = ait_vars2buffer(buf + wlen, sizeof buf - wlen, RPC_RETVARS(c)); + ret = ait_vars2buffer(buf + wlen, AIT_LEN(&c->cli_buf) - wlen, + RPC_RETVARS(c)); /* Free return values */ ait_freeVars(&c->cli_vars); if (ret == -1) {