This is an automated email from the ASF dual-hosted git repository. billblough pushed a commit to branch 1.0.x in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git
commit 2ec7aaebd2e7a82134c05b46b57c661169c33c11 Author: Don Samisa Abeysinghe <sam...@apache.org> AuthorDate: Tue May 1 15:08:06 2007 +0000 Fixed some memory leaks and compiler errors --- include/axis2_const.h | 2 ++ samples/server/axis2.xml | 11 +++------- src/core/engine/ctx_handler.c | 30 ++++++++++++++++++++++++---- src/core/transport/http/common/http_worker.c | 18 ++++++++++++++--- util/include/axutil_error.h | 2 -- 5 files changed, 46 insertions(+), 17 deletions(-) diff --git a/include/axis2_const.h b/include/axis2_const.h index 2a907fb..b4bb4f8 100644 --- a/include/axis2_const.h +++ b/include/axis2_const.h @@ -317,6 +317,8 @@ typedef enum axis2_wsdl_msg_labels #define AXIS2_ATTACHMENT_TEMP_DIR "attachmentDIR" #define AXIS2_CACHE_ATTACHMENTS "cacheAttachments" #define AXIS2_FILE_SIZE_THRESHOLD "sizeThreshold" +/* op_ctx persistance */ +#define AXIS2_PERSIST_OP_CTX "persistOperationContext" /******************************************************************************/ diff --git a/samples/server/axis2.xml b/samples/server/axis2.xml index 9c41e31..bc1bb3b 100644 --- a/samples/server/axis2.xml +++ b/samples/server/axis2.xml @@ -2,17 +2,12 @@ <!-- ================================================= --> <!-- Parameters --> <!-- ================================================= --> - <parameter name="hotdeployment" locked="false">false</parameter> - <parameter name="hotupdate" locked="false">false</parameter> + <!-- Uncomment following to enable MTOM support --> <!--parameter name="enableMTOM" locked="false">true</parameter--> - <!-- Uncomment this to enable REST support --> <parameter name="enableREST" locked="false">true</parameter> - - <parameter name="userName" locked="false">admin</parameter> - <parameter name="password" locked="false">axis2</parameter> - - <parameter name="seralizeLocation" locked="false">.</parameter> + <!-- Uncomment following to persist op_ctx, useful with RM --> + <!--parameter name="persistOperationContext" locked="false">true</parameter--> <!--if you want to extract the service archive file and work with that please uncomment this--> <!--else , it wont extract archive file or does not take into consideration if someone drop--> diff --git a/src/core/engine/ctx_handler.c b/src/core/engine/ctx_handler.c index bb40fce..dad0c3a 100644 --- a/src/core/engine/ctx_handler.c +++ b/src/core/engine/ctx_handler.c @@ -145,24 +145,46 @@ axis2_ctx_handler_invoke( else if (op) /* 2. if no op_ctx, create new op_ctx */ { axis2_conf_ctx_t *conf_ctx = NULL; - axutil_allocator_switch_to_global_pool(env->allocator); + axis2_bool_t use_pools = AXIS2_FALSE; + axutil_param_t *param = axis2_msg_ctx_get_parameter(msg_ctx, env, + AXIS2_PERSIST_OP_CTX); + + use_pools = (param && 0 == axutil_strcmp(AXIS2_VALUE_TRUE, + axutil_param_get_value(param, env))); + if (use_pools) + { + axutil_allocator_switch_to_global_pool(env->allocator); + } op_ctx = axis2_op_ctx_create(env, op, NULL); if (!op_ctx) { return AXIS2_FAILURE; } - axis2_msg_ctx_set_op_ctx(msg_ctx, env, op_ctx); + axis2_msg_ctx_set_op_ctx(msg_ctx, env, op_ctx); axis2_op_register_op_ctx(op, env, msg_ctx, op_ctx); conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env); if (conf_ctx) { + if (!use_pools) + { + axutil_allocator_switch_to_global_pool(env->allocator); + } + svc_grp_ctx = axis2_conf_ctx_fill_ctxs(conf_ctx, env, msg_ctx); - } - axutil_allocator_switch_to_local_pool(env->allocator); + if (!use_pools) + { + axutil_allocator_switch_to_local_pool(env->allocator); + } + } + + if (use_pools) + { + axutil_allocator_switch_to_local_pool(env->allocator); + } } if (!svc_grp_ctx && (axis2_msg_ctx_get_server_side(msg_ctx, env))) diff --git a/src/core/transport/http/common/http_worker.c b/src/core/transport/http/common/http_worker.c index 0f46bd9..d83680a 100644 --- a/src/core/transport/http/common/http_worker.c +++ b/src/core/transport/http/common/http_worker.c @@ -393,10 +393,9 @@ axis2_http_worker_process_request( { axis2_msg_ctx_t *out_msg_ctx = NULL, *in_msg_ctx = NULL; axis2_msg_ctx_t **msg_ctx_map = NULL; - + axis2_char_t *msg_id = NULL; + axis2_conf_ctx_t *conf_ctx = NULL; msg_ctx_map = axis2_op_ctx_get_msg_ctx_map(op_ctx, env); - if(!axis2_op_ctx_is_in_use(op_ctx, env)) - axis2_op_ctx_destroy_mutex(op_ctx, env); out_msg_ctx = msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_OUT]; in_msg_ctx = msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_IN]; @@ -410,11 +409,24 @@ axis2_http_worker_process_request( if (in_msg_ctx) { + msg_id = axis2_msg_ctx_get_msg_id(in_msg_ctx, env); + conf_ctx = axis2_msg_ctx_get_conf_ctx(in_msg_ctx, env); + axis2_msg_ctx_free(in_msg_ctx, env); in_msg_ctx = NULL; msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_IN] = NULL; } + if(!axis2_op_ctx_is_in_use(op_ctx, env)) + { + axis2_op_ctx_destroy_mutex(op_ctx, env); + if (conf_ctx && msg_id) + { + axis2_conf_ctx_register_op_ctx(conf_ctx, env, msg_id, NULL); + } + axis2_op_ctx_free(op_ctx, env); + } + } /* Done freeing message contexts */ msg_ctx = NULL; diff --git a/util/include/axutil_error.h b/util/include/axutil_error.h index 5f1fa3b..c443ee9 100644 --- a/util/include/axutil_error.h +++ b/util/include/axutil_error.h @@ -557,8 +557,6 @@ extern "C" */ AXIS2_ERROR_LAST }; - /* array to hold error messages */ - const axis2_char_t* axutil_error_messages[AXIS2_ERROR_LAST + 10000]; /** * \brief Array to hold error messages