ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r682013 - in /webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src: msgprocessors/ storage/beans/ util/
Date Sat, 02 Aug 2008 16:57:01 GMT
Author: damitha
Date: Sat Aug  2 09:57:00 2008
New Revision: 682013

URL: http://svn.apache.org/viewvc?rev=682013&view=rev
Log:
Fixing memory leaks

Modified:
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/terminate_seq_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/beans/seq_property_bean.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/seq_mgr.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/spec_specific_consts.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c?rev=682013&r1=682012&r2=682013&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
Sat Aug  2 09:57:00 2008
@@ -421,6 +421,7 @@
     }
 
     sandesha2_msg_ctx_add_soap_envelope(rm_msg_ctx, env);
+
     fault_ctx = sandesha2_fault_mgr_check_for_seq_closed(env, rm_msg_ctx, rmd_sequence_id,
seq_prop_mgr);
     if(fault_ctx)
     {

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c?rev=682013&r1=682012&r2=682013&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
Sat Aug  2 09:57:00 2008
@@ -243,8 +243,8 @@
 
     out_msg_ctx = sandesha2_utils_create_out_msg_ctx(env, create_seq_msg_ctx);
 
-    rmd_sequence_id = sandesha2_seq_mgr_setup_new_rmd_sequence(env, rm_msg_ctx, 
-            seq_prop_mgr, next_msg_mgr);
+    rmd_sequence_id = sandesha2_seq_mgr_setup_new_rmd_sequence(env, rm_msg_ctx, seq_prop_mgr,

+            next_msg_mgr);
 
     create_seq_res_msg = sandesha2_msg_creator_create_create_seq_res_msg(env, rm_msg_ctx,

             out_msg_ctx, rmd_sequence_id, seq_prop_mgr);
@@ -253,14 +253,21 @@
 
     if(!create_seq_res_msg)
     {
+        if(rmd_sequence_id)
+        {
+            AXIS2_FREE(env->allocator, rmd_sequence_id);
+        }
+
         if(seq_prop_mgr)
         {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
         }
+
         if(create_seq_mgr)
         {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
         }
+
         if(next_msg_mgr)
         {
             sandesha2_next_msg_mgr_free(next_msg_mgr, env);
@@ -295,14 +302,21 @@
                     "[sandesha2] Accept part has not genereated for a message with offer");
             AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING, AXIS2_FAILURE);
 
+            if(rmd_sequence_id)
+            {
+                AXIS2_FREE(env->allocator, rmd_sequence_id);
+            }
+
             if(seq_prop_mgr)
             {
                 sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
             }
+
             if(create_seq_mgr)
             {
                 sandesha2_create_seq_mgr_free(create_seq_mgr, env);
             }
+
             if(next_msg_mgr)
             {
                 sandesha2_next_msg_mgr_free(next_msg_mgr, env);
@@ -348,20 +362,33 @@
             sandesha2_create_seq_mgr_insert(create_seq_mgr, env, create_seq_bean);*/
             
             rms_sequence_bean = sandesha2_seq_property_bean_create(env);
-            sandesha2_seq_property_bean_set_name(rms_sequence_bean, env, SANDESHA2_SEQUENCE_PROPERTY_RMS_SEQ_ID);
+            if(rms_sequence_bean)
+            {
+                sandesha2_seq_property_bean_set_name(rms_sequence_bean, env, SANDESHA2_SEQUENCE_PROPERTY_RMS_SEQ_ID);
 
-            sandesha2_seq_property_bean_set_seq_id(rms_sequence_bean, env, rms_internal_seq_id);
-            sandesha2_seq_property_bean_set_value(rms_sequence_bean, env, rms_sequence_id);
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] rmd_sequence_id:%s",
rmd_sequence_id); 
-            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rms_sequence_bean);
+                sandesha2_seq_property_bean_set_seq_id(rms_sequence_bean, env, rms_internal_seq_id);
+                sandesha2_seq_property_bean_set_value(rms_sequence_bean, env, rms_sequence_id);
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] rmd_sequence_id:%s",
rmd_sequence_id); 
+                sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rms_sequence_bean);
+                sandesha2_seq_property_bean_free(rms_sequence_bean, env);
+            }
 
             rms_internal_sequence_bean = sandesha2_seq_property_bean_create(env);
-            sandesha2_seq_property_bean_set_name(rms_internal_sequence_bean, env, 
+            if(rms_internal_sequence_bean)
+            {
+                sandesha2_seq_property_bean_set_name(rms_internal_sequence_bean, env, 
                     SANDESHA2_SEQUENCE_PROPERTY_RMS_INTERNAL_SEQ_ID);
 
-            sandesha2_seq_property_bean_set_seq_id(rms_internal_sequence_bean, env, rms_sequence_id);
-            sandesha2_seq_property_bean_set_value(rms_internal_sequence_bean, env, rms_internal_seq_id);
-            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rms_internal_sequence_bean);
+                sandesha2_seq_property_bean_set_seq_id(rms_internal_sequence_bean, env, rms_sequence_id);
+                sandesha2_seq_property_bean_set_value(rms_internal_sequence_bean, env, rms_internal_seq_id);
+                sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rms_internal_sequence_bean);
+                sandesha2_seq_property_bean_free(rms_internal_sequence_bean, env);
+            }
+
+            if(rms_internal_seq_id)
+            {
+                AXIS2_FREE(env->allocator, rms_internal_seq_id);
+            }
         }
         else
         {
@@ -377,14 +404,21 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Acks to is null");
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_EPR, AXIS2_FAILURE);
 
+        if(rmd_sequence_id)
+        {
+            AXIS2_FREE(env->allocator, rmd_sequence_id);
+        }
+
         if(seq_prop_mgr)
         {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
         }
+
         if(create_seq_mgr)
         {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
         }
+
         if(next_msg_mgr)
         {
             sandesha2_next_msg_mgr_free(next_msg_mgr, env);
@@ -396,8 +430,11 @@
     acks_to_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id, 
             SANDESHA2_SEQ_PROP_ACKS_TO_EPR, (axis2_char_t*)axis2_endpoint_ref_get_address(acks_to,

                 env));
-
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
+    if(acks_to_bean)
+    {
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
+        sandesha2_seq_property_bean_free(acks_to_bean, env);
+    }
 
     axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
     sandesha2_seq_mgr_update_last_activated_time(env, rmd_sequence_id, seq_prop_mgr);
@@ -422,15 +459,23 @@
             SANDESHA2_SEQ_PROP_TO_EPR);
     if(!to_bean)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]wsa:To is not set");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] wsa:To is not set");
+
+        if(rmd_sequence_id)
+        {
+            AXIS2_FREE(env->allocator, rmd_sequence_id);
+        }
+
         if(seq_prop_mgr)
         {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
         }
+
         if(create_seq_mgr)
         {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
         }
+
         if(next_msg_mgr)
         {
             sandesha2_next_msg_mgr_free(next_msg_mgr, env);
@@ -457,18 +502,27 @@
     {
         axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_FALSE);
     }
+
+    sandesha2_seq_property_bean_free(to_bean, env);
    
     /* Pausing the flow here so that it won't go to a message receiver which is not set for
this flow */
     sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
 
+    if(rmd_sequence_id)
+    {
+        AXIS2_FREE(env->allocator, rmd_sequence_id);
+    }
+
     if(seq_prop_mgr)
     {
         sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
     }
+
     if(create_seq_mgr)
     {
         sandesha2_create_seq_mgr_free(create_seq_mgr, env);
     }
+
     if(next_msg_mgr)
     {
         sandesha2_next_msg_mgr_free(next_msg_mgr, env);
@@ -513,7 +567,11 @@
     AXIS2_PARAM_CHECK(env->error, create_seq_mgr, AXIS2_FALSE);
     
     find_create_seq_bean = sandesha2_create_seq_bean_create_with_data(env, NULL, NULL, seq_id);
-    list = sandesha2_create_seq_mgr_find(create_seq_mgr, env, find_create_seq_bean);
+    if(find_create_seq_bean)
+    {
+        list = sandesha2_create_seq_mgr_find(create_seq_mgr, env, find_create_seq_bean);
+        sandesha2_create_seq_bean_free(find_create_seq_bean, env);
+    }
     
     if(list)
     {
@@ -540,7 +598,11 @@
     }
 
     find_seq_property_bean = sandesha2_seq_property_bean_create_with_data(env, NULL, NULL,
seq_id);
-    list = sandesha2_seq_property_mgr_find(seq_property_mgr, env, find_seq_property_bean);
+    if(find_seq_property_bean)
+    {
+        list = sandesha2_seq_property_mgr_find(seq_property_mgr, env, find_seq_property_bean);
+        sandesha2_seq_property_bean_free(find_seq_property_bean, env);
+    }
     
     if(list)
     {
@@ -569,7 +631,11 @@
                     internal_seq_id = sandesha2_seq_property_bean_get_value(seq_prop_bean,
env);
 
                     temp_find_bean = sandesha2_seq_property_bean_create_with_data(env, NULL,
NULL, internal_seq_id);
-                    temp_list = sandesha2_seq_property_mgr_find(seq_property_mgr, env, temp_find_bean);
+                    if(temp_find_bean)
+                    {
+                        temp_list = sandesha2_seq_property_mgr_find(seq_property_mgr, env,
temp_find_bean);
+                        sandesha2_seq_property_bean_free(temp_find_bean, env);
+                    }
                 
                     if(temp_list)
                     {

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/terminate_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/terminate_seq_msg_processor.c?rev=682013&r1=682012&r2=682013&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/terminate_seq_msg_processor.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/terminate_seq_msg_processor.c
Sat Aug  2 09:57:00 2008
@@ -203,15 +203,18 @@
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
                 "[sandesha2] Terminate Sequence part is not available");
+
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING, AXIS2_FAILURE);
+
         return AXIS2_FAILURE;
     }
 
     rmd_sequence_id = sandesha2_identifier_get_identifier(sandesha2_terminate_seq_get_identifier(
-                term_seq, env), env);
+        term_seq, env), env);
     if(!rmd_sequence_id || 0 == axutil_strlen(rmd_sequence_id))
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Invalid sequence id");
+
         return AXIS2_FAILURE;
     }
 
@@ -334,6 +337,11 @@
                         internal_sequence_id, storage_mgr, seq_prop_mgr, create_seq_mgr,
sender_mgr);
             }
         }
+
+        if(internal_sequence_id)
+        {
+            AXIS2_FREE(env->allocator, internal_sequence_id);
+        }
     }
     else
     {
@@ -415,8 +423,10 @@
     
     highest_in_msg_num_str = sandesha2_utils_get_seq_property(env, seq_id,
         SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_NUMBER, seq_prop_mgr);
+
     highest_in_msg_id = sandesha2_utils_get_seq_property(env, seq_id,
         SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_ID, seq_prop_mgr);
+
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]highest_in_msg_num_str:%s",
         highest_in_msg_num_str);
 
@@ -426,6 +436,7 @@
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
                     "[sandesha2] highest in msg id has not been stored");
+
             if(highest_in_msg_num_str)
             {
                 AXIS2_FREE(env->allocator, highest_in_msg_num_str);
@@ -477,6 +488,7 @@
 
             highest_out_msg_num_str = sandesha2_utils_get_seq_property(env, rec_side_int_seq_id,

                     SANDESHA2_SEQ_PROP_HIGHEST_OUT_MSG_NUMBER, seq_prop_mgr);
+
             highest_out_msg_num = atol(highest_out_msg_num_str);
             add_rec_side_term = AXIS2_TRUE;
             if(highest_out_msg_num_str)
@@ -497,6 +509,7 @@
     }
 
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]add_rec_side_term:%d", add_rec_side_term);
+
     out_seq_id = sandesha2_utils_get_seq_property(env, rec_side_int_seq_id,
         SANDESHA2_SEQUENCE_PROPERTY_RMS_SEQ_ID, seq_prop_mgr);
 
@@ -552,11 +565,13 @@
     sandesha2_sender_bean_t *term_res_bean = NULL;
     axis2_char_t *key = NULL;
     sandesha2_sender_mgr_t *retrans_mgr = NULL;*/
+
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, seq_prop_mgr, AXIS2_FAILURE);
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Entry:sandesha2_"\
-        "terminate_seq_msg_processor_add_terminate_seq_res");
+
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
+            "[sandesha2] Entry:sandesha2_terminate_seq_msg_processor_add_terminate_seq_res");
     
     msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
     out_msg_ctx = sandesha2_utils_create_out_msg_ctx(env, msg_ctx);
@@ -617,7 +632,9 @@
     /* end test code */
     
     engine = axis2_engine_create(env, axis2_msg_ctx_get_conf_ctx(msg_ctx, env));
+
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]axis2_engine_send");
+
     axis2_engine_send(engine, env, out_msg_ctx); 
     op_ctx = axis2_msg_ctx_get_op_ctx(out_msg_ctx, env);
     if(to_epr)

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/beans/seq_property_bean.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/beans/seq_property_bean.c?rev=682013&r1=682012&r2=682013&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/beans/seq_property_bean.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/beans/seq_property_bean.c
Sat Aug  2 09:57:00 2008
@@ -171,8 +171,10 @@
 		AXIS2_FREE(env->allocator, seq_property_bean->value);
 		seq_property_bean->value = NULL;
 	}
+
     if(value)
+    {
         seq_property_bean->value = (axis2_char_t *)axutil_strdup(env, value);
-
+    }
 }
 

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c?rev=682013&r1=682012&r2=682013&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
Sat Aug  2 09:57:00 2008
@@ -594,6 +594,7 @@
     sandesha2_msg_ctx_set_terminate_seq(terminate_rm_msg, env, terminate_seq);
     sandesha2_msg_creator_finalize_creation(env, ref_msg_ctx, terminate_seq_msg_ctx);
     axis2_msg_ctx_set_property(terminate_seq_msg_ctx, env, AXIS2_TRANSPORT_IN, NULL);
+
     return terminate_rm_msg;
 }
 
@@ -637,22 +638,27 @@
     rm_version = sandesha2_utils_get_rm_version(env, seq_id, seq_prop_mgr);
     if(!rm_version)
     {
-        rm_version = sandesha2_msg_ctx_get_rm_spec_ver(ref_rm_msg, env);
+        rm_version = axutil_strdup(env, sandesha2_msg_ctx_get_rm_spec_ver(ref_rm_msg, env));
     }
-    temp_action = sandesha2_spec_specific_consts_get_teminate_seq_res_action(
-        env, rm_version);
+
+    temp_action = sandesha2_spec_specific_consts_get_teminate_seq_res_action(env, rm_version);
     if(rm_version)
+    {
         AXIS2_FREE(env->allocator, rm_version);
+    }
+
     axis2_msg_ctx_set_wsa_action(out_msg, env, temp_action);
     soap_action = axutil_string_create(env, temp_action);
-    axis2_msg_ctx_set_soap_action(out_msg, env, soap_action); 
-    sandesha2_msg_creator_init_creation(env, sandesha2_msg_ctx_get_msg_ctx(
-                        ref_rm_msg, env), out_msg);
+    axis2_msg_ctx_set_soap_action(out_msg, env, soap_action);
+    axutil_string_free(soap_action, env);
+    sandesha2_msg_creator_init_creation(env, sandesha2_msg_ctx_get_msg_ctx(ref_rm_msg, env),

+            out_msg);
+
     sandesha2_msg_ctx_add_soap_envelope(ref_rm_msg, env);
-    sandesha2_msg_creator_finalize_creation(env, sandesha2_msg_ctx_get_msg_ctx(
-                        ref_rm_msg, env), out_msg);
-    axis2_msg_ctx_set_server_side(sandesha2_msg_ctx_get_msg_ctx(ref_rm_msg, env), 
-                        env, AXIS2_TRUE);
+    sandesha2_msg_creator_finalize_creation(env, sandesha2_msg_ctx_get_msg_ctx(ref_rm_msg,
env), 
+            out_msg);
+
+    axis2_msg_ctx_set_server_side(sandesha2_msg_ctx_get_msg_ctx(ref_rm_msg, env), env, AXIS2_TRUE);
     return res_rm_msg;
 }
 
@@ -795,7 +801,7 @@
     axis2_msg_ctx_t *related_msg,
     axis2_msg_ctx_t *new_msg)
 {
-    axis2_svc_t *related_svc = NULL;
+    /*axis2_svc_t *related_svc = NULL;
     axis2_svc_t *new_svc = NULL;
 
     related_svc = axis2_msg_ctx_get_svc(related_msg, env);
@@ -804,19 +810,17 @@
     {
         axutil_param_t *ref_policy_param = NULL;
 
-        ref_policy_param = axis2_svc_get_param(related_svc, env, 
-                SANDESHA2_SANDESHA_PROPERTY_BEAN);
+        ref_policy_param = axis2_svc_get_param(related_svc, env, SANDESHA2_SANDESHA_PROPERTY_BEAN);
         if(ref_policy_param)
         {
             void *value = NULL;
             axutil_param_t *new_policy_param = NULL;
 
             value = axutil_param_get_value(ref_policy_param, env);
-            new_policy_param = axutil_param_create(env, 
-                    SANDESHA2_SANDESHA_PROPERTY_BEAN, value);
+            new_policy_param = axutil_param_create(env, SANDESHA2_SANDESHA_PROPERTY_BEAN,
value);
         }
         
-    }
+    }*/
     return AXIS2_SUCCESS;
 }
 

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c?rev=682013&r1=682012&r2=682013&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c
Sat Aug  2 09:57:00 2008
@@ -1030,28 +1030,40 @@
     axutil_array_list_t *acked_msgs_list = NULL;
     long smallest_msg_no = 1;
     long temp_msg_no = 0;
+    axis2_bool_t ret = AXIS2_TRUE;
+
+    client_completed_msgs = sandesha2_utils_get_seq_property(env, internal_seq_id, 
+            SANDESHA2_SEQ_PROP_CLIENT_COMPLETED_MESSAGES, seq_prop_mgr);
+
+    if(client_completed_msgs)
+    {
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Client_completed_msgs:%s",

+            client_completed_msgs);
+
+        acked_msgs_list = sandesha2_utils_get_array_list_from_string(env, client_completed_msgs);
+        AXIS2_FREE(env->allocator, client_completed_msgs);
+    }
 
-    client_completed_msgs = sandesha2_utils_get_seq_property(env, 
-        internal_seq_id, SANDESHA2_SEQ_PROP_CLIENT_COMPLETED_MESSAGES, 
-        seq_prop_mgr);
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[sandesha2]client_completed_msgs:%s", client_completed_msgs);
-    acked_msgs_list = sandesha2_utils_get_array_list_from_string(env, 
-        client_completed_msgs);
     if(!acked_msgs_list)
+    {
         return AXIS2_FALSE;
-    for(temp_msg_no = smallest_msg_no; temp_msg_no <= highest_in_msg_no; 
-        temp_msg_no++)
+    }
+
+    for(temp_msg_no = smallest_msg_no; temp_msg_no <= highest_in_msg_no; temp_msg_no++)
     {
         axis2_char_t str_msg_no[32];
+
         sprintf(str_msg_no, "%ld", temp_msg_no);
-        if(!sandesha2_utils_array_list_contains(env, acked_msgs_list, 
-            str_msg_no))
+        if(!sandesha2_utils_array_list_contains(env, acked_msgs_list, str_msg_no))
         {
-            return AXIS2_FALSE;
+            ret = AXIS2_FALSE;
+            break;
         }
     }
-    return AXIS2_TRUE; /* All messages upto the highest have been acked */
+    
+    axutil_array_list_free(acked_msgs_list, env);
+
+    return ret; /* All messages upto the highest have been acked */
 }
 
 axis2_status_t AXIS2_CALL
@@ -1266,6 +1278,7 @@
         AXIS2_FREE(env->allocator, msg_uuid);
         msg_uuid = NULL;
     }
+
     reply_to = axis2_msg_info_headers_get_reply_to(old_msg_info_headers, env);
     axis2_msg_info_headers_set_to(msg_info_headers, env, sandesha2_util_endpoint_ref_clone(env,

                 reply_to));

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/seq_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/seq_mgr.c?rev=682013&r1=682012&r2=682013&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/seq_mgr.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/seq_mgr.c
Sat Aug  2 09:57:00 2008
@@ -107,17 +107,19 @@
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_ACKS_TO_IS_NULL, AXIS2_FAILURE);
         return NULL; 
     }
+
     msg_ctx = sandesha2_msg_ctx_get_msg_ctx(create_seq_msg, env);
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-    received_msg_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id,

-            SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES, "");
 
     /* Setting the addressing version */
     addressing_ns_value = sandesha2_msg_ctx_get_addr_ns_val(create_seq_msg, env);
     addressing_ns_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id,

             SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, addressing_ns_value);
-
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, addressing_ns_bean);
+    if(addressing_ns_bean)
+    {
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, addressing_ns_bean);
+        sandesha2_seq_property_bean_free(addressing_ns_bean, env);
+    }
     anonymous_uri = sandesha2_spec_specific_consts_get_anon_uri(env, addressing_ns_value);

 
     /* If no replyTo value. Send responses as sync. */
@@ -133,27 +135,49 @@
                 SANDESHA2_SEQ_PROP_TO_EPR, anonymous_uri);
     }
 
+    if(to_bean)
+    {
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, to_bean);
+        sandesha2_seq_property_bean_free(to_bean, env);
+    }
+
     address = (axis2_char_t*)axis2_endpoint_ref_get_address(to, env);
     reply_to_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id, 
         SANDESHA2_SEQ_PROP_REPLY_TO_EPR, address);
+    if(reply_to_bean)
+    {
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, reply_to_bean);
+        sandesha2_seq_property_bean_free(reply_to_bean, env);
+    }
 
     address = (axis2_char_t*)axis2_endpoint_ref_get_address(acks_to, env);
     acks_to_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id, 
         SANDESHA2_SEQ_PROP_ACKS_TO_EPR, address);
 
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, received_msg_bean);
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, reply_to_bean);
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
-    if(to_bean)
+    if(acks_to_bean)
     {
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, to_bean);
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
+        sandesha2_seq_property_bean_free(acks_to_bean, env);
     }
 
+    received_msg_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id,

+            SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES, "");
+    if(received_msg_bean)
+    {
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, received_msg_bean);
+        sandesha2_seq_property_bean_free(received_msg_bean, env);
+    }
+
+
     next_msg_bean = sandesha2_next_msg_bean_create_with_data(env, rmd_sequence_id, 1); 
                                                     /* 1 will be the next */
-    internal_sequence_id = sandesha2_utils_get_internal_sequence_id(env, rmd_sequence_id);
-    sandesha2_next_msg_bean_set_internal_seq_id(next_msg_bean, env, internal_sequence_id);
-    sandesha2_next_msg_mgr_insert(next_msg_mgr, env, next_msg_bean);
+    if(next_msg_bean)
+    {
+        internal_sequence_id = sandesha2_utils_get_internal_sequence_id(env, rmd_sequence_id);
+        sandesha2_next_msg_bean_set_internal_seq_id(next_msg_bean, env, internal_sequence_id);
+        sandesha2_next_msg_mgr_insert(next_msg_mgr, env, next_msg_bean);
+        sandesha2_next_msg_bean_free(next_msg_bean, env);
+    }
 
     /* Message to invoke. This will apply for only in-order invocations */
     /*if(!axis2_msg_ctx_get_server_side(msg_ctx, env) || !sandesha2_utils_is_anon_uri(env,

@@ -191,12 +215,21 @@
     }
 
     spec_version_bean = sandesha2_seq_property_bean_create(env);
-    sandesha2_seq_property_bean_set_seq_id(spec_version_bean, env, rmd_sequence_id);
-    sandesha2_seq_property_bean_set_name(spec_version_bean, env, SANDESHA2_SEQ_PROP_RM_SPEC_VERSION);
-    sandesha2_seq_property_bean_set_value(spec_version_bean, env, spec_version);
+    if(spec_version_bean)
+    {
+        sandesha2_seq_property_bean_set_seq_id(spec_version_bean, env, rmd_sequence_id);
+        sandesha2_seq_property_bean_set_name(spec_version_bean, env, SANDESHA2_SEQ_PROP_RM_SPEC_VERSION);
+        sandesha2_seq_property_bean_set_value(spec_version_bean, env, spec_version);
    
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr,env, spec_version_bean);
-    sandesha2_seq_property_bean_free(spec_version_bean, env);
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr,env, spec_version_bean);
+        sandesha2_seq_property_bean_free(spec_version_bean, env);
+    }
+
+    if(spec_version)
+    {
+        AXIS2_FREE(env->allocator, spec_version);
+    }
+
     /* TODO Get the SOAP version from the creaet sequence message */
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Entry:sandesha2_seq_mgr_setup_new_rmd_sequence");

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/spec_specific_consts.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/spec_specific_consts.c?rev=682013&r1=682012&r2=682013&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/spec_specific_consts.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/spec_specific_consts.c
Sat Aug  2 09:57:00 2008
@@ -323,7 +323,6 @@
         const axutil_env_t *env,
         axis2_char_t *spec_version)
 {
-    AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK(env->error, spec_version, NULL);
     
     if (0 == axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, spec_version)) 

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c?rev=682013&r1=682012&r2=682013&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
Sat Aug  2 09:57:00 2008
@@ -261,7 +261,7 @@
             if(bean)
             {
                 axis2_char_t *key = NULL;
-                axis2_char_t *seq_id = NULL;
+                axis2_char_t *temp_seq_id = NULL;
 
                 key = sandesha2_next_msg_bean_get_ref_msg_key(bean, env);
                 if(key)
@@ -269,10 +269,10 @@
                     sandesha2_storage_mgr_remove_msg_ctx(storage_mgr, env, key, conf_ctx,
-1);
                 }
 
-                seq_id = sandesha2_next_msg_bean_get_seq_id(bean, env);
-                if(seq_id)
+                temp_seq_id = sandesha2_next_msg_bean_get_seq_id(bean, env);
+                if(temp_seq_id)
                 {
-                    sandesha2_next_msg_mgr_remove(next_msg_mgr, env, seq_id);
+                    sandesha2_next_msg_mgr_remove(next_msg_mgr, env, temp_seq_id);
                 }
             }
             
@@ -322,6 +322,7 @@
     
     all_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
         SANDESHA2_SEQ_PROP_ALL_SEQS, SANDESHA2_SEQ_PROP_INCOMING_SEQ_LIST);
+
     if(all_seq_bean)
     {
         axutil_array_list_t *all_seq_list = NULL;
@@ -331,27 +332,54 @@
             sandesha2_seq_property_bean_get_value(all_seq_bean, env));
         if(all_seq_list)
         {
-            int i = 0;
-            for(i = 0; i < axutil_array_list_size(all_seq_list, env); i++)
+            int i = 0, j = 0, size = 0;
+
+            size = axutil_array_list_size(all_seq_list, env);
+
+            for(i = 0; i < size; i++)
             {
                 axis2_char_t *value = axutil_array_list_get(all_seq_list, env, i);
-                if(0 == axutil_strcmp(value, seq_id))
+                
+                if(value)
                 {
-                    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                        "[sandesha2]Removing seq id:%s from the all incoming "\
-                        "sequence list", value);
-                    axutil_array_list_remove(all_seq_list, env, i);
-                    break;
+                    if(!axutil_strcmp(value, seq_id))
+                    {
+                        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                            "[sandesha2]Removing seq id:%s from the all incoming sequence
list", value);
+                        axutil_array_list_remove(all_seq_list, env, i);
+                        AXIS2_FREE(env->allocator, value);
+                        break;
+                    }
+
+                    AXIS2_FREE(env->allocator, value);
+                }
+            }
+
+            for(j = i++; j < size; j++)
+            {
+                axis2_char_t *value = axutil_array_list_get(all_seq_list, env, i);
+                if(value)
+                {
+                    AXIS2_FREE(env->allocator, value);
                 }
             }
+
             all_seq_str = sandesha2_utils_array_list_to_string(env, all_seq_list,
                 SANDESHA2_ARRAY_LIST_STRING);
+
             sandesha2_seq_property_bean_set_value(all_seq_bean, env, all_seq_str);
             if(all_seq_str)
+            {
                 AXIS2_FREE(env->allocator, all_seq_str);
+            }
+
             sandesha2_seq_property_mgr_update(seq_prop_mgr, env, all_seq_bean);
+            axutil_array_list_free(all_seq_list, env);
         }
+
+        sandesha2_seq_property_bean_free(all_seq_bean, env);
     }
+
     find_seq_prop_bean = sandesha2_seq_property_bean_create(env);
     sandesha2_seq_property_bean_set_seq_id(find_seq_prop_bean, env, seq_id);
     found_list = sandesha2_seq_property_mgr_find(seq_prop_mgr, env, find_seq_prop_bean);
@@ -371,7 +399,7 @@
                 sandesha2_seq_property_bean_get_name(seq_prop_bean, env)))
             {
                 axis2_char_t *highest_in_msg_key_str = NULL;
-                axis2_char_t *seq_id = sandesha2_seq_property_bean_get_seq_id(seq_prop_bean,
env);
+                axis2_char_t *temp_seq_id = sandesha2_seq_property_bean_get_seq_id(seq_prop_bean,
env);
                 axis2_char_t *name = sandesha2_seq_property_bean_get_name(seq_prop_bean,
env);
 
                 if(!axutil_strcmp(name, SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_NUMBER))
@@ -386,9 +414,9 @@
 
                 AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
                         "[sandesha2] Removing the sequence property named %s in the sequence
%s", 
-                        name, seq_id);
+                        name, temp_seq_id);
 
-                sandesha2_seq_property_mgr_remove(seq_prop_mgr, env, seq_id, name);
+                sandesha2_seq_property_mgr_remove(seq_prop_mgr, env, temp_seq_id, name);
             }
             
             sandesha2_seq_property_bean_free(seq_prop_bean, env);
@@ -832,16 +860,23 @@
     terminated = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, rms_sequence_id,

             SANDESHA2_SEQ_PROP_TERMINATE_ADDED);
 
-    if(terminated && sandesha2_seq_property_bean_get_value(terminated, env) &&
0 == axutil_strcmp(
-                AXIS2_VALUE_TRUE, sandesha2_seq_property_bean_get_value(terminated, env)))
+    if(terminated)
     {
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+        axis2_char_t *value = sandesha2_seq_property_bean_get_value(terminated, env);
+
+        if(value && !axutil_strcmp(AXIS2_VALUE_TRUE, value))
+        {
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
                 "[sandesha2] Terminate sequence message was added previously");
 
-        /* If we do not return at this, there will be two terminate messsages
-         * sent to the client
-         */
-        return AXIS2_SUCCESS;
+            /* If we do not return at this, there will be two terminate messsages
+             * sent to the client
+             */
+            sandesha2_seq_property_bean_free(terminated, env);
+            return AXIS2_SUCCESS;
+        }
+
+        sandesha2_seq_property_bean_free(terminated, env);
     }
 
     terminate_rm_msg_ctx = sandesha2_msg_creator_create_terminate_seq_msg(env, ack_rm_msg_ctx,

@@ -932,15 +967,13 @@
                 is_svr_side, storage_mgr, seq_prop_mgr, create_seq_mgr, sender_mgr);
         terminate_added = sandesha2_seq_property_bean_create(env);
 
-        sandesha2_seq_property_bean_set_name(terminate_added, env, 
-                SANDESHA2_SEQ_PROP_TERMINATE_ADDED);
-
-        sandesha2_seq_property_bean_set_seq_id(terminate_added, env, rms_sequence_id);
-        sandesha2_seq_property_bean_set_value(terminate_added, env, AXIS2_VALUE_TRUE);
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, terminate_added);
-
         if(terminate_added)
         {
+            sandesha2_seq_property_bean_set_name(terminate_added, env, SANDESHA2_SEQ_PROP_TERMINATE_ADDED);
+
+            sandesha2_seq_property_bean_set_seq_id(terminate_added, env, rms_sequence_id);
+            sandesha2_seq_property_bean_set_value(terminate_added, env, AXIS2_VALUE_TRUE);
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, terminate_added);
             sandesha2_seq_property_bean_free(terminate_added, env);
         }
 
@@ -1129,16 +1162,14 @@
 
     sandesha2_terminate_mgr_terminate_sending_side(env, conf_ctx, internal_sequence_id, is_svr_side,

             storage_mgr, seq_prop_mgr, create_seq_mgr, sender_mgr);
-    terminate_added = sandesha2_seq_property_bean_create(env);
-
-    sandesha2_seq_property_bean_set_name(terminate_added, env, SANDESHA2_SEQ_PROP_TERMINATE_ADDED);
-
-    sandesha2_seq_property_bean_set_seq_id(terminate_added, env, rms_sequence_id);
-    sandesha2_seq_property_bean_set_value(terminate_added, env, AXIS2_VALUE_TRUE);
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, terminate_added);
 
+    terminate_added = sandesha2_seq_property_bean_create(env);
     if(terminate_added)
     {
+        sandesha2_seq_property_bean_set_name(terminate_added, env, SANDESHA2_SEQ_PROP_TERMINATE_ADDED);
+        sandesha2_seq_property_bean_set_seq_id(terminate_added, env, rms_sequence_id);
+        sandesha2_seq_property_bean_set_value(terminate_added, env, AXIS2_VALUE_TRUE);
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, terminate_added);
         sandesha2_seq_property_bean_free(terminate_added, env);
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Mime
View raw message