--- libaitrpc/src/srv.c 2022/10/13 22:09:36 1.30.2.2 +++ libaitrpc/src/srv.c 2024/02/26 12:49:55 1.30.2.5 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: srv.c,v 1.30.2.2 2022/10/13 22:09:36 misho Exp $ +* $Id: srv.c,v 1.30.2.5 2024/02/26 12:49:55 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004 - 2022 +Copyright 2004 - 2024 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -387,7 +387,7 @@ rxPacket(sched_task_t *task) schedEvent(TASK_ROOT(task), execCall, TASK_ARG(task), (int) noreply, rpc, len); err: /* send RPC reply */ - if (!noreply) + if (!noreply && (rpc->call_io & RPC_REQ)) schedWrite(TASK_ROOT(task), cbProto[s->srv_proto][CB_TXPACKET], TASK_ARG(task), TASK_FD(task), rpc, len); @@ -575,7 +575,7 @@ rxUDPPacket(sched_task_t *task) schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len); /* send RPC reply */ - if (!noreply) + if (!noreply && (rpc->call_io & RPC_REQ)) schedWrite(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET], c, TASK_FD(task), rpc, len); end: @@ -739,7 +739,7 @@ rxRAWPacket(sched_task_t *task) schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len); /* send RPC reply */ - if (!noreply) + if (!noreply && (rpc->call_io & RPC_REQ)) schedWrite(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET], c, TASK_FD(task), rpc, len); end: @@ -909,7 +909,7 @@ rxBPFPacket(sched_task_t *task) schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len); /* send RPC reply */ - if (!noreply) + if (!noreply && (rpc->call_io & RPC_REQ)) schedEvent(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET], c, TASK_FD(task), rpc, len); end: @@ -1039,7 +1039,7 @@ rxEXTPacket(sched_task_t *task) schedEvent(TASK_ROOT(task), execCall, c, (int) noreply, rpc, len); /* send RPC reply */ - if (!noreply) + if (!noreply && (rpc->call_io & RPC_REQ)) schedWrite(TASK_ROOT(task), cbProto[srv->srv_proto][CB_TXPACKET], c, TASK_FD(task), rpc, len); end: @@ -1558,7 +1558,8 @@ rpc_srv_initServer(u_char InstID, int concurentClients pthread_mutex_destroy(&srv->srv_funcs.mtx); e_free(srv); return NULL; - } + } else + schedSignalDispatch(srv->srv_root, 42); /* init pool for clients */ srv->srv_clients = array_Init(concurentClients); @@ -1680,6 +1681,7 @@ rpc_srv_loopServer(rpc_srv_t * __restrict srv) schedPolling(srv->srv_root, &ts, NULL); /* main rpc loop */ schedRun(srv->srv_root, &srv->srv_kill); + schedSignalDispatch(srv->srv_root, 0); /* close all clients connections & server socket */ for (i = 0; i < array_Size(srv->srv_clients); i++) { @@ -1818,7 +1820,8 @@ rpc_srv_initServer2(u_char InstID, int concurentClient pthread_mutex_destroy(&srv->srv_funcs.mtx); e_free(srv); return NULL; - } + } else + schedSignalDispatch(srv->srv_root, 42); /* init pool for clients */ srv->srv_clients = array_Init(concurentClients); @@ -1936,7 +1939,8 @@ rpc_srv_initServerExt(u_char InstID, int netBuf, int f pthread_mutex_destroy(&srv->srv_funcs.mtx); e_free(srv); return NULL; - } + } else + schedSignalDispatch(srv->srv_root, 42); /* init pool for clients */ srv->srv_clients = array_Init(1);