|
|
| version 1.11.2.4, 2012/11/05 17:06:51 | version 1.11.2.5, 2012/11/13 09:21:27 |
|---|---|
| Line 737 rpc_srv_initServer(u_int regProgID, u_char regProcID, | Line 737 rpc_srv_initServer(u_int regProgID, u_char regProcID, |
| srv->srv_server.cli_parent = srv; | srv->srv_server.cli_parent = srv; |
| memcpy(&srv->srv_server.cli_sa, &sa, sizeof srv->srv_server.cli_sa); | memcpy(&srv->srv_server.cli_sa, &sa, sizeof srv->srv_server.cli_sa); |
| /* init functions list */ | /* init functions */ |
| TAILQ_INIT(&srv->srv_funcs); | pthread_mutex_init(&srv->srv_funcs.mtx, NULL); |
| SLIST_INIT(&srv->srv_funcs); | |
| AVL_INIT(&srv->srv_funcs); | |
| /* init scheduler */ | /* init scheduler */ |
| srv->srv_root = schedBegin(); | srv->srv_root = schedBegin(); |
| if (!srv->srv_root) { | if (!srv->srv_root) { |
| rpc_SetErr(sched_GetErrno(), "%s", sched_GetError()); | rpc_SetErr(sched_GetErrno(), "%s", sched_GetError()); |
| pthread_mutex_destroy(&srv->srv_funcs.mtx); | |
| io_free(srv); | io_free(srv); |
| return NULL; | return NULL; |
| } | } |
| Line 753 rpc_srv_initServer(u_int regProgID, u_char regProcID, | Line 756 rpc_srv_initServer(u_int regProgID, u_char regProcID, |
| if (!srv->srv_clients) { | if (!srv->srv_clients) { |
| rpc_SetErr(io_GetErrno(), "%s", io_GetError()); | rpc_SetErr(io_GetErrno(), "%s", io_GetError()); |
| schedEnd(&srv->srv_root); | schedEnd(&srv->srv_root); |
| pthread_mutex_destroy(&srv->srv_funcs.mtx); | |
| io_free(srv); | io_free(srv); |
| return NULL; | return NULL; |
| } | } |
| Line 763 rpc_srv_initServer(u_int regProgID, u_char regProcID, | Line 767 rpc_srv_initServer(u_int regProgID, u_char regProcID, |
| LOGERR; | LOGERR; |
| io_arrayDestroy(&srv->srv_clients); | io_arrayDestroy(&srv->srv_clients); |
| schedEnd(&srv->srv_root); | schedEnd(&srv->srv_root); |
| pthread_mutex_destroy(&srv->srv_funcs.mtx); | |
| io_free(srv); | io_free(srv); |
| return NULL; | return NULL; |
| } | } |
| Line 792 err: /* error condition */ | Line 797 err: /* error condition */ |
| close(srv->srv_server.cli_sock); | close(srv->srv_server.cli_sock); |
| io_arrayDestroy(&srv->srv_clients); | io_arrayDestroy(&srv->srv_clients); |
| schedEnd(&srv->srv_root); | schedEnd(&srv->srv_root); |
| pthread_mutex_destroy(&srv->srv_funcs.mtx); | |
| io_free(srv); | io_free(srv); |
| return NULL; | return NULL; |
| } | } |
| Line 815 rpc_srv_endServer(rpc_srv_t ** __restrict psrv) | Line 821 rpc_srv_endServer(rpc_srv_t ** __restrict psrv) |
| (*psrv)->srv_kill = 1; | (*psrv)->srv_kill = 1; |
| sleep(RPC_SCHED_POLLING); | sleep(RPC_SCHED_POLLING); |
| pthread_mutex_destroy(&(*psrv)->srv_funcs.mtx); | |
| io_free(*psrv); | io_free(*psrv); |
| *psrv = NULL; | *psrv = NULL; |
| } | } |
| Line 830 rpc_srv_loopServer(rpc_srv_t * __restrict srv) | Line 837 rpc_srv_loopServer(rpc_srv_t * __restrict srv) |
| { | { |
| rpc_cli_t *c; | rpc_cli_t *c; |
| register int i; | register int i; |
| rpc_func_t *f, *tmp; | rpc_func_t *f; |
| struct timespec ts = { RPC_SCHED_POLLING, 0 }; | struct timespec ts = { RPC_SCHED_POLLING, 0 }; |
| if (!srv) { | if (!srv) { |
| Line 872 rpc_srv_loopServer(rpc_srv_t * __restrict srv) | Line 879 rpc_srv_loopServer(rpc_srv_t * __restrict srv) |
| close(srv->srv_server.cli_sock); | close(srv->srv_server.cli_sock); |
| /* detach exported calls */ | /* detach exported calls */ |
| TAILQ_FOREACH_SAFE(f, &srv->srv_funcs, func_node, tmp) { | RPC_FUNCS_LOCK(&srv->srv_funcs); |
| TAILQ_REMOVE(&srv->srv_funcs, f, func_node); | while ((f = SLIST_FIRST(&srv->srv_funcs))) { |
| SLIST_REMOVE_HEAD(&srv->srv_funcs, func_next); | |
| AIT_FREE_VAL(&f->func_name); | AIT_FREE_VAL(&f->func_name); |
| io_free(f); | io_free(f); |
| } | } |
| srv->srv_funcs.avlh_root = NULL; | |
| RPC_FUNCS_UNLOCK(&srv->srv_funcs); | |
| schedEnd(&srv->srv_root); | schedEnd(&srv->srv_root); |
| return 0; | return 0; |