--- libaitrpc/src/builtin.c 2012/03/13 08:25:25 1.5.2.1 +++ libaitrpc/src/builtin.c 2012/05/14 08:39:05 1.7 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: builtin.c,v 1.5.2.1 2012/03/13 08:25:25 misho Exp $ +* $Id: builtin.c,v 1.7 2012/05/14 08:39:05 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -129,11 +129,14 @@ rpcServerCalls(rpc_func_t *call, int ic, array_t *iv) memset(val, 0, len); for (f = srv->srv_funcs, i = 0; f; f = f->func_next) { - if (*f->func_name) { + if (*AIT_GET_STR(&f->func_name)) { memset(str, 0, sizeof str); - snprintf(str, sizeof str, "/%s/%s(%d); ", - *f->func_file ? f->func_file : "*", - f->func_name, io_arraySize(f->func_vars)); + if (AIT_ISEMPTY(&f->func_file)) + snprintf(str, sizeof str, "/*/%s(%d); ", + AIT_GET_STR(&f->func_name), io_arraySize(f->func_vars)); + else + snprintf(str, sizeof str, "/%s/%s(%d); ", AIT_GET_STR(&f->func_file), + AIT_GET_STR(&f->func_name), io_arraySize(f->func_vars)); strlcat(val, str, len); } } @@ -181,9 +184,7 @@ rpcServerShutdown(rpc_func_t *call, int ic, array_t *i else srv = call->func_parent; - pthread_mutex_lock(&srv->srv_mtx); srv->srv_kill = kill; - pthread_mutex_unlock(&srv->srv_mtx); return 0; } @@ -201,9 +202,7 @@ rpcBLOBServerShutdown(rpc_func_t *call, int ic, array_ else srv = call->func_parent; - pthread_mutex_lock(&srv->srv_blob.mtx); srv->srv_blob.state = kill; - pthread_mutex_unlock(&srv->srv_blob.mtx); return 0; } @@ -235,19 +234,16 @@ rpcBLOBServerVars(rpc_func_t *call, int ic, array_t *i return 1; } - pthread_mutex_lock(&srv->srv_blob.mtx); for (i = 0, b = srv->srv_blob.blobs; b; i++, b = b->blob_next); len = i * sizeof str; if (!len) { AIT_SET_STR(io_array(vals, 0, ait_val_t*), ""); - pthread_mutex_unlock(&srv->srv_blob.mtx); return 0; } if (!(val = malloc(len))) { LOGERR; - pthread_mutex_unlock(&srv->srv_blob.mtx); return -1; } else memset(val, 0, len); @@ -260,7 +256,6 @@ rpcBLOBServerVars(rpc_func_t *call, int ic, array_t *i AIT_SET_STR(io_array(vals, 0, ait_val_t*), val); free(val); - pthread_mutex_unlock(&srv->srv_blob.mtx); return 0; } @@ -278,9 +273,7 @@ rpcBLOBServerState(rpc_func_t *call, int ic, array_t * if (AIT_TYPE(io_array(iv, 0, ait_val_t*)) != i32) return -1; - pthread_mutex_lock(&srv->srv_mtx); srv->srv_blob.state = AIT_GET_I32(io_array(iv, 0, ait_val_t*)); - pthread_mutex_unlock(&srv->srv_mtx); return 0; }