--- libaitrpc/src/srv.c 2012/05/17 15:14:16 1.9.2.23 +++ libaitrpc/src/srv.c 2012/05/17 15:48:45 1.9.2.25 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: srv.c,v 1.9.2.23 2012/05/17 15:14:16 misho Exp $ +* $Id: srv.c,v 1.9.2.25 2012/05/17 15:48:45 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -602,11 +602,6 @@ rpc_srv_endBLOBServer(rpc_srv_t * __restrict srv) if (!srv) return; - if (srv->srv_blob.tid) { - pthread_cancel(srv->srv_blob.tid); - pthread_join(srv->srv_blob.tid, NULL); - } - /* close all clients connections & server socket */ for (i = 0; i < io_arraySize(srv->srv_blob.clients); i++) { c = io_array(srv->srv_blob.clients, i, rpc_cli_t*); @@ -621,6 +616,10 @@ rpc_srv_endBLOBServer(rpc_srv_t * __restrict srv) } io_arrayDestroy(&srv->srv_blob.clients); + srv->srv_blob.kill = 1; + if (srv->srv_blob.tid) + pthread_cancel(srv->srv_blob.tid); + close(srv->srv_blob.server.cli_sock); /* detach blobs */ @@ -675,7 +674,7 @@ rpc_srv_loopBLOBServer(rpc_srv_t * __restrict srv) * @regProgID = ProgramID for authentication & recognition * @regProcID = ProcessID for authentication & recognition * @concurentClients = Concurent clients at same time to this server - * @netBuf = Network buffer length, if =0 == BUFSIZ (also meaning max RPC packet) + * @netBuf = Network buffer length (min:512 bytes), if =0 == BUFSIZ (also meaning max RPC packet) * @csHost = Host name or address for bind server, if NULL any address * @Port = Port for bind server, if Port == 0 default port is selected * return: NULL == error or !=NULL bind and created RPC server instance @@ -696,7 +695,7 @@ rpc_srv_initServer(u_int regProgID, u_char regProcID, return NULL; if (!Port) Port = RPC_DEFPORT; - if (!netBuf) + if (netBuf < RPC_MIN_BUFSIZ) netBuf = BUFSIZ; else netBuf = io_align(netBuf, 1); /* align netBuf length */