--- libaitrpc/src/srv.c 2013/08/22 11:55:45 1.17.6.1 +++ libaitrpc/src/srv.c 2013/08/22 12:22:25 1.17.6.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: srv.c,v 1.17.6.1 2013/08/22 11:55:45 misho Exp $ +* $Id: srv.c,v 1.17.6.2 2013/08/22 12:22:25 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -172,6 +172,7 @@ txPacket(sched_task_t *task) f = rpc_srv_getCall(s, ntohs(rpc->call_tag)); if (!f) { rpc_SetErr(EPROGUNAVAIL, "Function not found at RPC server"); + rpc->call_argc ^= rpc->call_argc; rpc->call_rep.ret = RPC_ERROR(-1); rpc->call_rep.eno = RPC_ERROR(rpc_Errno); @@ -217,17 +218,17 @@ execCall(sched_task_t *task) rpc_srv_t *s = c->cli_parent; rpc_func_t *f = NULL; array_t *arr = NULL; - u_char *buf = AIT_GET_BUF(&c->cli_buf) + TASK_VAL(task); + u_char *buf = AIT_GET_BUF(&c->cli_buf); struct tagRPCCall *rpc = (struct tagRPCCall*) buf; int argc = ntohs(rpc->call_argc); /* Go decapsulate variables ... */ if (argc) { arr = ait_buffer2vars(buf + sizeof(struct tagRPCCall), - AIT_LEN(&c->cli_buf) - TASK_VAL(task) - sizeof(struct tagRPCCall), - argc, 42); + AIT_LEN(&c->cli_buf) - sizeof(struct tagRPCCall), argc, 42); if (!arr) { rpc_SetErr(ERPCMISMATCH, "#%d - %s", elwix_GetErrno(), elwix_GetError()); + rpc->call_argc ^= rpc->call_argc; rpc->call_rep.ret = RPC_ERROR(-1); rpc->call_rep.eno = RPC_ERROR(rpc_Errno); @@ -238,6 +239,7 @@ execCall(sched_task_t *task) if (!(f = rpc_srv_getCall(s, ntohs(rpc->call_tag)))) { rpc_SetErr(EPROGUNAVAIL, "Function not found at RPC server"); + rpc->call_argc ^= rpc->call_argc; rpc->call_rep.ret = RPC_ERROR(-1); rpc->call_rep.eno = RPC_ERROR(rpc_Errno); @@ -331,12 +333,14 @@ rxPacket(sched_task_t *task) /* check RPC packet session info */ if (rpc_chkPktSession(&rpc->call_session, &s->srv_session)) { rpc_SetErr(ERPCMISMATCH, "Get invalid RPC session"); + rpc->call_argc ^= rpc->call_argc; rpc->call_rep.ret = RPC_ERROR(-1); rpc->call_rep.eno = RPC_ERROR(errno); } else { /* execute RPC call */ - schedEvent(TASK_ROOT(task), execCall, TASK_ARG(task), off, NULL, 0); + schedEvent(TASK_ROOT(task), execCall, TASK_ARG(task), + (int) noreply, rpc, len); } /* send RPC reply */ @@ -506,12 +510,14 @@ rxUDPPacket(sched_task_t *task) /* check RPC packet session info */ if (rpc_chkPktSession(&rpc->call_session, &srv->srv_session)) { rpc_SetErr(ERPCMISMATCH, "Get invalid RPC session"); + rpc->call_argc ^= rpc->call_argc; rpc->call_rep.ret = RPC_ERROR(-1); rpc->call_rep.eno = RPC_ERROR(errno); } else { /* execute RPC call */ - schedEvent(TASK_ROOT(task), execCall, c, off, NULL, 0); + schedEvent(TASK_ROOT(task), execCall, c, + (int) noreply, rpc, len); } /* send RPC reply */