--- libaitrpc/src/srv.c 2012/03/15 01:55:33 1.7 +++ libaitrpc/src/srv.c 2012/03/28 01:17:09 1.7.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: srv.c,v 1.7 2012/03/15 01:55:33 misho Exp $ +* $Id: srv.c,v 1.7.2.1 2012/03/28 01:17:09 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -114,7 +114,7 @@ execCall(sched_task_t *task) ioTRACE(RPC_TRACE_LEVEL); /* Go decapsulate variables ... */ - if (!(rpc->call_req.flags & RPC_NOREPLY) && argc) { + if (argc) { arr = io_buffer2vars(buf + sizeof(struct tagRPCCall), TASK_DATLEN(task) - sizeof(struct tagRPCCall), argc, 1); if (!arr) { @@ -135,13 +135,20 @@ execCall(sched_task_t *task) ioDEBUG(RPC_DEBUG_LEVEL, "RPC function %s from module %s", AIT_GET_STR(&f->func_name), AIT_GET_LIKE(&f->func_file, char*)); + /* if client doesn't want reply */ + argc = rpc->call_req.flags & RPC_NOREPLY; rpc->call_rep.ret = RPC_ERROR(rpc_srv_execCall(f, rpc, arr)); if (rpc->call_rep.ret == htonl(-1)) { rpc->call_rep.eno = RPC_ERROR(errno); rpc->call_argc ^= rpc->call_argc; } else { rpc->call_rep.eno ^= rpc->call_rep.eno; - rpc->call_argc = htons(rpc_srv_getVars(f, NULL)); + if (argc) { + /* without reply */ + io_clrVars(f->func_vars); + rpc->call_argc ^= rpc->call_argc; + } else + rpc->call_argc = htons(rpc_srv_getVars(f, NULL)); } } @@ -312,7 +319,7 @@ rxBLOB(sched_task_t *task) ioTRACE(RPC_TRACE_LEVEL); /* check for disable service at this moment? */ - if (s->srv_blob.state == disable) { + if (!s || s->srv_blob.state == disable) { usleep(100000); #ifdef HAVE_PTHREAD_YIELD pthread_yield();