From: Miloš Mulač Date: Tue, 10 Oct 2006 09:18:56 +0000 (+0000) Subject: cleanup in pool size X-Git-Tag: merge_connpool_src~7 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=dc1ce88351d82c8e4ea9bd8cd4bfe34fdc66740b;p=jra1mw.git cleanup in pool size - definition of pool size moved from log_proto.h to connpool.h - renamed from EDG_WLL_LOG_CONNECTIONS_DEFAULT to GLITE_LB_COMMON_CONNPOOL_SIZE - possible to set from env via *CONNPOOL_SIZE instead of *QUERY_CONNECTIONS --- diff --git a/org.glite.lb.client-interface/interface/context.h b/org.glite.lb.client-interface/interface/context.h index 747c44c..9c78a55 100644 --- a/org.glite.lb.client-interface/interface/context.h +++ b/org.glite.lb.client-interface/interface/context.h @@ -43,7 +43,7 @@ typedef enum _edg_wll_ContextParam { EDG_WLL_PARAM_QUERY_JOBS_LIMIT, /**< maximal query jobs result size */ EDG_WLL_PARAM_QUERY_EVENTS_LIMIT,/**< maximal query events result size */ EDG_WLL_PARAM_QUERY_RESULTS, /**< maximal query result size */ - EDG_WLL_PARAM_QUERY_CONNECTIONS,/**< maximal number of open connections in ctx->connPoll */ + EDG_WLL_PARAM_CONNPOOL_SIZE, /**< maximal number of open connections in connectionsHandle.poolSize */ EDG_WLL_PARAM_NOTIF_SERVER, /**< default notification server name */ EDG_WLL_PARAM_NOTIF_SERVER_PORT,/**< default notification server port */ EDG_WLL_PARAM_NOTIF_TIMEOUT, /**< notif timeout */ diff --git a/org.glite.lb.common/interface/connpool.h b/org.glite.lb.common/interface/connpool.h index af874ac..c47d6bc 100644 --- a/org.glite.lb.common/interface/connpool.h +++ b/org.glite.lb.common/interface/connpool.h @@ -16,6 +16,9 @@ extern "C" { #ifndef EDG_WLL_CONNPOOL_DECLARED #define EDG_WLL_CONNPOOL_DECLARED 1 +#define GLITE_LB_COMMON_CONNPOOL_SIZE 4 + + typedef struct _edg_wll_ConnPool { /* address and port where we are connected to */ char *peerName; diff --git a/org.glite.lb.common/interface/log_proto.h b/org.glite.lb.common/interface/log_proto.h index 51996af..062324e 100644 --- a/org.glite.lb.common/interface/log_proto.h +++ b/org.glite.lb.common/interface/log_proto.h @@ -68,7 +68,7 @@ extern "C" { /** * default maximal number of simultaneously open connections from one client */ -#define EDG_WLL_LOG_CONNECTIONS_DEFAULT 4 +// XXX: not used? #define EDG_WLL_LOG_CONNECTIONS_DEFAULT 4 #ifdef __cplusplus diff --git a/org.glite.lb.common/src/connpool.c b/org.glite.lb.common/src/connpool.c index c265ce0..fb84222 100644 --- a/org.glite.lb.common/src/connpool.c +++ b/org.glite.lb.common/src/connpool.c @@ -2,12 +2,12 @@ #ifdef GLITE_LB_THREADED edg_wll_Connections connectionsHandle = - { NULL , NULL , EDG_WLL_LOG_CONNECTIONS_DEFAULT , 0 , PTHREAD_MUTEX_INITIALIZER , NULL , NULL}; + { NULL , NULL , GLITE_LB_COMMON_CONNPOOL_SIZE , 0 , PTHREAD_MUTEX_INITIALIZER , NULL , NULL}; #endif #ifndef GLITE_LB_THREADED edg_wll_Connections connectionsHandle = - { NULL , NULL , EDG_WLL_LOG_CONNECTIONS_DEFAULT , 0 , NULL}; + { NULL , NULL , GLITE_LB_COMMON_CONNPOOL_SIZE , 0 , NULL}; #endif /** Lock (try) the pool */ diff --git a/org.glite.lb.common/src/param.c b/org.glite.lb.common/src/param.c index 82dc590..02d218f 100644 --- a/org.glite.lb.common/src/param.c +++ b/org.glite.lb.common/src/param.c @@ -30,7 +30,7 @@ static const char *myenv[] = { "%sQUERY_JOBS_LIMIT", "%sQUERY_EVENTS_LIMIT", "%sQUERY_RESULTS", - "%sQUERY_CONNECTIONS", + "%sCONNPOOL_SIZE", "%sNOTIF_SERVER", "%sNOTIF_SERVER", "%sNOTIF_TIMEOUT", @@ -238,13 +238,12 @@ int edg_wll_SetParamInt(edg_wll_Context ctx,edg_wll_ContextParam param,int val) return edg_wll_SetError(ctx,EINVAL,"can't parse query result parameter name"); } break; - case EDG_WLL_PARAM_QUERY_CONNECTIONS: + case EDG_WLL_PARAM_CONNPOOL_SIZE: { char *s = mygetenv(param); if (!val && s) val = atoi(s); -// ctx->connections->poolSize = val ? val : EDG_WLL_LOG_CONNECTIONS_DEFAULT; - connectionsHandle.poolSize = val ? val : EDG_WLL_LOG_CONNECTIONS_DEFAULT; + connectionsHandle.poolSize = val ? val : GLITE_LB_COMMON_CONNPOOL_SIZE; } break; case EDG_WLL_PARAM_SOURCE: @@ -313,7 +312,7 @@ int edg_wll_SetParam(edg_wll_Context ctx,edg_wll_ContextParam param,...) case EDG_WLL_PARAM_QUERY_JOBS_LIMIT: case EDG_WLL_PARAM_QUERY_EVENTS_LIMIT: case EDG_WLL_PARAM_QUERY_RESULTS: - case EDG_WLL_PARAM_QUERY_CONNECTIONS: + case EDG_WLL_PARAM_CONNPOOL_SIZE: case EDG_WLL_PARAM_SOURCE: return edg_wll_SetParamInt(ctx,param,va_arg(ap,int)); case EDG_WLL_PARAM_HOST: @@ -379,9 +378,9 @@ int edg_wll_GetParam(edg_wll_Context ctx,edg_wll_ContextParam param,...) p_int = va_arg(ap, int *); *p_int = ctx->p_query_results; break; - case EDG_WLL_PARAM_QUERY_CONNECTIONS: + case EDG_WLL_PARAM_CONNPOOL_SIZE: p_int = va_arg(ap, int *); - *p_int = ctx->connections->poolSize; + *p_int = connectionsHandle.poolSize; break; case EDG_WLL_PARAM_SOURCE: p_int = va_arg(ap, int *);