Author: damitha
Date: Thu Jul 31 12:29:19 2008
New Revision: 681448

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

Modified:
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_seq_mgr.h
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_storage_mgr.h
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c
    
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_res_msg_processor.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/msg_store_bean.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/permanent_storage_mgr.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/ack_mgr.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_retrans_adjuster.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

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_seq_mgr.h
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_seq_mgr.h?rev=681448&r1=681447&r2=681448&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_seq_mgr.h
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_seq_mgr.h
 Thu Jul 31 12:29:19 2008
@@ -66,7 +66,6 @@
 sandesha2_seq_mgr_has_seq_timedout(
     const axutil_env_t *env,
     axis2_char_t *property_key,
-    sandesha2_msg_ctx_t *rm_msg_ctx,
     struct sandesha2_seq_property_mgr *seq_prop_mgr,
     axis2_conf_ctx_t *conf_ctx);
         

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_storage_mgr.h
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_storage_mgr.h?rev=681448&r1=681447&r2=681448&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_storage_mgr.h
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_storage_mgr.h
 Thu Jul 31 12:29:19 2008
@@ -141,7 +141,6 @@
                 const axutil_env_t *env, 
                 axis2_char_t *seq_id,
                 int msg_no);
-
 };
 
 AXIS2_DECLARE_DATA struct sandesha2_storage_mgr

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c?rev=681448&r1=681447&r2=681448&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c
 Thu Jul 31 12:29:19 2008
@@ -335,6 +335,7 @@
 
                     axutil_array_list_free(msg_no_list, env);
                 }
+
             }
 
             if(!drop)
@@ -345,15 +346,16 @@
                 axiom_children_iterator_t *children_iterator = NULL;
                 axis2_bool_t empty_body = AXIS2_FALSE;
             
-                soap_body = axiom_soap_envelope_get_body(
-                    sandesha2_msg_ctx_get_soap_envelope(rm_msg_ctx, env), 
-                    env);
+                soap_body = 
axiom_soap_envelope_get_body(sandesha2_msg_ctx_get_soap_envelope(
+                        rm_msg_ctx, env), env);
                 body_node = axiom_soap_body_get_base_node(soap_body, env);
                 body_element = axiom_node_get_data_element(body_node, env);
-                children_iterator = axiom_element_get_children(body_element, 
env, 
-                    body_node);
+                children_iterator = axiom_element_get_children(body_element, 
env, body_node);
                 if(!axiom_children_iterator_has_next(children_iterator, env))
+                {
                     empty_body = AXIS2_TRUE;
+                }
+
                 if(empty_body)
                 {
                     axis2_char_t *rcvd_msgs_str1 = NULL;
@@ -362,35 +364,40 @@
                     sandesha2_msg_processor_t *app_msg_processor = NULL;
                     
                     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                        "[sandesha2]Empty body last msg recieved");
+                            "[sandesha2] Empty body last msg recieved");
+
                     drop = AXIS2_TRUE;
                     if(!rcvd_msgs_bean)
                     {
-                        rcvd_msgs_bean = 
sandesha2_seq_property_bean_create_with_data
-                            (env, rmd_sequence_id, 
-                            SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES, "");
-                        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
-                            rcvd_msgs_bean);
+                        rcvd_msgs_bean = 
sandesha2_seq_property_bean_create_with_data(env, 
+                                rmd_sequence_id, 
SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES, "");
+                        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, 
rcvd_msgs_bean);
                     }
-                    rcvd_msgs_str1 = sandesha2_seq_property_bean_get_value(
-                            rcvd_msgs_bean, env);
+
+                    rcvd_msgs_str1 = 
sandesha2_seq_property_bean_get_value(rcvd_msgs_bean, env);
                     sprintf(msg_no_str, "%ld", msg_no);
                     if(rcvd_msgs_str1 && 0 < axutil_strlen(rcvd_msgs_str1))
-                        bean_value = axutil_strcat(env, rcvd_msgs_str1, ",",
-                            msg_no_str, NULL);
+                    {
+                        bean_value = axutil_strcat(env, rcvd_msgs_str1, ",", 
msg_no_str, NULL);
+                    }
                     else
+                    {
                         bean_value = axutil_strdup(env, msg_no_str);
+                    }
                     
-                    sandesha2_seq_property_bean_set_value(rcvd_msgs_bean, env,
-                        bean_value);
-                    sandesha2_seq_property_mgr_update(seq_prop_mgr, env, 
-                        rcvd_msgs_bean);
+                    sandesha2_seq_property_bean_set_value(rcvd_msgs_bean, env, 
bean_value);
+                    sandesha2_seq_property_mgr_update(seq_prop_mgr, env, 
rcvd_msgs_bean);
                     app_msg_processor = 
sandesha2_app_msg_processor_create(env);
                     sandesha2_app_msg_processor_send_ack_if_reqd(env, 
rm_msg_ctx, bean_value, 
                             rmd_sequence_id, storage_mgr, sender_mgr, 
seq_prop_mgr);
                     sandesha2_msg_processor_free(app_msg_processor, env);
                 }
             }
+
+            if(rcvd_msgs_bean)
+            {
+                sandesha2_seq_property_bean_free(rcvd_msgs_bean, env);
+            }
         }        
     } 
     else if(SANDESHA2_MSG_TYPE_UNKNOWN == sandesha2_msg_ctx_get_msg_type(

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=681448&r1=681447&r2=681448&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
 Thu Jul 31 12:29:19 2008
@@ -920,6 +920,7 @@
     sandesha2_seq_property_bean_t *res_highest_msg_bean = NULL;
     axis2_char_t msg_number_str[32];
     axis2_bool_t send_create_seq = AXIS2_FALSE;
+    sandesha2_seq_property_bean_t *spec_ver_bean = NULL;
     axis2_char_t *spec_ver = NULL;
     axiom_soap_envelope_t *soap_env = NULL;
     axis2_endpoint_ref_t *to_epr = NULL;
@@ -1112,7 +1113,6 @@
 
         if(last_app_msg && !axutil_strcmp(last_app_msg, AXIS2_VALUE_TRUE))
         {
-            axis2_char_t *spec_ver = NULL;
             spec_ver = sandesha2_utils_get_rm_version(env, 
internal_sequence_id, seq_prop_mgr);
             if(!spec_ver)
             {
@@ -1129,6 +1129,7 @@
             if(spec_ver)
             {
                 AXIS2_FREE(env->allocator, spec_ver);
+                spec_ver = NULL;
             }
         }
     }
@@ -1136,44 +1137,56 @@
     seq_timeout_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
internal_sequence_id, 
             SANDESHA2_SEQ_PROP_SEQ_TIMED_OUT);
 
-    if(seq_timeout_bean && 
sandesha2_seq_property_bean_get_value(seq_timeout_bean, env) 
-        && !axutil_strcmp(AXIS2_VALUE_TRUE, 
sandesha2_seq_property_bean_get_value(seq_timeout_bean, 
-                env)))
+    if(seq_timeout_bean)
     {
-        axis2_char_t *temp_int_seq_id = 
sandesha2_seq_property_bean_get_seq_id(seq_timeout_bean, env);
-        axis2_char_t *temp_name = 
sandesha2_seq_property_bean_get_name(seq_timeout_bean, env);
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                "[sandesha2] Removing the sequence property named %s in the 
sequence %s", temp_name, 
-                temp_int_seq_id);
-        sandesha2_seq_property_mgr_remove(seq_prop_mgr, env, temp_int_seq_id, 
temp_name);
+        axis2_bool_t exit_system = AXIS2_FALSE;
+        axis2_char_t *str_timeout = 
sandesha2_seq_property_bean_get_value(seq_timeout_bean, env);
 
-        if(req_rm_msg_ctx)
+        if(str_timeout && !axutil_strcmp(AXIS2_VALUE_TRUE, str_timeout))
         {
-            sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
-        }
-        if(internal_sequence_id)
-        {
-                AXIS2_FREE(env->allocator, internal_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(sender_mgr)
-        {
-            sandesha2_sender_mgr_free(sender_mgr, env);
+            axis2_char_t *temp_int_seq_id = 
sandesha2_seq_property_bean_get_seq_id(seq_timeout_bean, env);
+            axis2_char_t *temp_name = 
sandesha2_seq_property_bean_get_name(seq_timeout_bean, env);
+
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                    "[sandesha2] Removing the sequence property named %s in 
the sequence %s", temp_name, 
+                    temp_int_seq_id);
+
+            sandesha2_seq_property_mgr_remove(seq_prop_mgr, env, 
temp_int_seq_id, temp_name);
+
+            if(req_rm_msg_ctx)
+            {
+                sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
+            }
+            if(internal_sequence_id)
+            {
+                    AXIS2_FREE(env->allocator, internal_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(sender_mgr)
+            {
+                sandesha2_sender_mgr_free(sender_mgr, env);
+            }
+            if(storage_mgr)
+            {
+                sandesha2_storage_mgr_free(storage_mgr, env);
+            }
+
+            /* We should halt the system here. Otherwise application client 
keep on sending messages. */
+            exit_system = AXIS2_TRUE;
         }
-        if(storage_mgr)
+
+        sandesha2_seq_property_bean_free(seq_timeout_bean, env);
+        if(exit_system)
         {
-            sandesha2_storage_mgr_free(storage_mgr, env);
+            exit(AXIS2_FAILURE);
         }
-
-        /* We should halt the system here. Otherwise application client keep 
on sending messages. */
-        exit(AXIS2_FAILURE);
     }
 
     property = axis2_msg_ctx_get_property(msg_ctx, env, 
SANDESHA2_CLIENT_MESSAGE_NUMBER);
@@ -1286,9 +1299,9 @@
     res_highest_msg_bean = sandesha2_seq_property_bean_create_with_data(env, 
internal_sequence_id, 
             SANDESHA2_SEQ_PROP_HIGHEST_OUT_MSG_NUMBER, msg_number_str);
 
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, res_highest_msg_bean);
     if(res_highest_msg_bean)
     {
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, 
res_highest_msg_bean);
         sandesha2_seq_property_bean_free(res_highest_msg_bean, env);
     }
 
@@ -1301,8 +1314,12 @@
         response_relates_to_bean = 
sandesha2_seq_property_bean_create_with_data(env, 
                 internal_sequence_id, 
SANDESHA2_SEQ_PROP_HIGHEST_OUT_RELATES_TO, 
                 (axis2_char_t *) relates_to_value);
-
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, 
response_relates_to_bean);
+        
+        if(response_relates_to_bean)
+        {
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, 
response_relates_to_bean);
+            sandesha2_seq_property_bean_free(response_relates_to_bean, env);
+        }
     }
 
     if(last_msg)
@@ -1312,26 +1329,28 @@
         res_last_msg_key_bean = 
sandesha2_seq_property_bean_create_with_data(env, 
                 internal_sequence_id, SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NO, 
msg_number_str);
 
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, 
res_last_msg_key_bean);
+        if(res_last_msg_key_bean)
+        {
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, 
res_last_msg_key_bean);
+            sandesha2_seq_property_bean_free(res_last_msg_key_bean, env);
+        }
     }
 
 
     if(is_svr_side)
     {
         sandesha2_seq_property_bean_t *rmd_to_bean = NULL;
-        sandesha2_seq_property_bean_t *spec_ver_bean = NULL;
 
         rmd_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
rmd_sequence_id, 
                 SANDESHA2_SEQ_PROP_TO_EPR);
         if(rmd_to_bean)
         {
             axis2_char_t *rmd_to = NULL;
-            axis2_char_t *value = NULL;
     
-            value = sandesha2_seq_property_bean_get_value(rmd_to_bean, env);
-            rmd_to = axutil_strdup(env, value);
-            property = axutil_property_create_with_args(env, 0, 0, 0, rmd_to);
+            rmd_to = axutil_strdup(env, 
sandesha2_seq_property_bean_get_value(rmd_to_bean, env));
+            property = axutil_property_create_with_args(env, 0, AXIS2_TRUE, 0, 
rmd_to);
             axis2_msg_ctx_set_property(msg_ctx, env, 
SANDESHA2_SEQ_PROP_TO_EPR, property);
+            sandesha2_seq_property_bean_free(rmd_to_bean, env);
         }
        
         spec_ver_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
rmd_sequence_id, 
@@ -1427,6 +1446,16 @@
                 seq_prop_mgr);
     }
 
+    if(rms_sequence_bean)
+    {
+        sandesha2_seq_property_bean_free(rms_sequence_bean, env);
+    }
+
+    if(spec_ver_bean)
+    {
+        sandesha2_seq_property_bean_free(spec_ver_bean, env);
+    }
+
     if(send_create_seq)
     {
         sandesha2_seq_property_bean_t *create_seq_added = NULL;

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c?rev=681448&r1=681447&r2=681448&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c
 Thu Jul 31 12:29:19 2008
@@ -439,10 +439,6 @@
             {
                 sandesha2_storage_mgr_free(storage_mgr, env);
             }
-            if(create_seq_rm_msg)
-            {
-                sandesha2_msg_ctx_free(create_seq_rm_msg, env);
-            }
 
             return AXIS2_FAILURE;
         }
@@ -494,6 +490,12 @@
             {
                 sandesha2_storage_mgr_free(storage_mgr, env);
             }
+        
+            if(create_seq_msg)
+            {
+                axis2_msg_ctx_free(create_seq_msg, env);
+            }
+
             if(create_seq_rm_msg)
             {
                 sandesha2_msg_ctx_free(create_seq_rm_msg, env);
@@ -512,6 +514,11 @@
         sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, 
new_msg_store_key, create_seq_msg, 
                 AXIS2_TRUE);
 
+        if(create_seq_msg)
+        {
+            axis2_msg_ctx_free(create_seq_msg, env);
+        }
+
         if(create_seq_rm_msg)
         {
             sandesha2_msg_ctx_free(create_seq_rm_msg, env);

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/msg_store_bean.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/msg_store_bean.c?rev=681448&r1=681447&r2=681448&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/msg_store_bean.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/msg_store_bean.c
 Thu Jul 31 12:29:19 2008
@@ -97,11 +97,15 @@
         AXIS2_FREE(env->allocator, msg_store_bean->stored_key);
         msg_store_bean->stored_key = NULL;
     }
+
+    /* We should not free the envelope buffer here. Ownership is transferred 
to storage manager
+    msg_store_bean->soap_env_str = NULL;*/
     if(msg_store_bean->soap_env_str)
     {
         AXIS2_FREE(env->allocator, msg_store_bean->soap_env_str);
         msg_store_bean->soap_env_str = NULL;
     }
+
     if(msg_store_bean->op)
     {
         AXIS2_FREE(env->allocator, msg_store_bean->op);
@@ -183,6 +187,11 @@
     const axutil_env_t *env,
     axis2_char_t * msg_id) 
 {
+    if(msg_store_bean->msg_id)
+    {
+        AXIS2_FREE(env->allocator, msg_store_bean->msg_id);
+    }
+
     msg_store_bean->msg_id = axutil_strdup(env, msg_id);
 }
 
@@ -200,6 +209,11 @@
     const axutil_env_t *env,
     axis2_char_t * key) 
 {
+    if(msg_store_bean->stored_key)
+    {
+        AXIS2_FREE(env->allocator, msg_store_bean->stored_key);
+    }
+
     msg_store_bean->stored_key = axutil_strdup(env, key);
 }
 
@@ -217,6 +231,11 @@
     const axutil_env_t *env,
     axis2_char_t * soap_env_str) 
 {
+    if(msg_store_bean->soap_env_str)
+    {
+        AXIS2_FREE(env->allocator, msg_store_bean->soap_env_str);
+    }
+
     msg_store_bean->soap_env_str = axutil_strdup(env, soap_env_str);
 }
 

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/permanent_storage_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/permanent_storage_mgr.c?rev=681448&r1=681447&r2=681448&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/permanent_storage_mgr.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/storage/sqlite/permanent_storage_mgr.c
 Thu Jul 31 12:29:19 2008
@@ -52,6 +52,7 @@
 {
        sandesha2_storage_mgr_t storage_mgr;
     sandesha2_permanent_bean_mgr_t *bean_mgr;
+    axutil_array_list_t *envelope_buffer_list;
 } sandesha2_permanent_storage_mgr_t;
 
 #define SANDESHA2_INTF_TO_IMPL(trans) \
@@ -190,6 +191,7 @@
         sizeof(sandesha2_permanent_storage_mgr_t));
 
     storage_mgr_impl->bean_mgr = NULL;
+    storage_mgr_impl->envelope_buffer_list = axutil_array_list_create(env, 0);
     storage_mgr_impl->bean_mgr = sandesha2_permanent_bean_mgr_create(env,
         dbname, NULL);
     storage_mgr_impl->storage_mgr.ops = &storage_mgr_ops;
@@ -219,6 +221,27 @@
         sandesha2_permanent_bean_mgr_free(storage_mgr_impl->bean_mgr, env);
         storage_mgr_impl->bean_mgr = NULL;
     }
+    
+    if(storage_mgr_impl->envelope_buffer_list)
+    {
+        int i = 0, size = 0;
+
+        size = axutil_array_list_size(storage_mgr_impl->envelope_buffer_list, 
env);
+        for(i = 0; i < size; i++)
+        {
+            axis2_char_t *buffer = NULL;
+            
+            buffer = 
axutil_array_list_get(storage_mgr_impl->envelope_buffer_list, env, i);
+            if(buffer)
+            {
+                AXIS2_FREE(env->allocator, buffer);
+            }
+        }
+
+        axutil_array_list_free(storage_mgr_impl->envelope_buffer_list, env);
+        storage_mgr_impl->envelope_buffer_list = NULL;
+    }
+
     if(storage_mgr_impl)
     {
         AXIS2_FREE(env->allocator, storage_mgr_impl);
@@ -374,27 +397,27 @@
     sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
     axis2_msg_ctx_t *msg_ctx = NULL;
     axis2_conf_t *conf = NULL;
-    axis2_svc_grp_t *svc_grp = NULL;
-    axis2_svc_t *svc = NULL;
     AXIS2_TRANSPORT_ENUMS transport_out = -1;
-    axis2_char_t *soap_env_str = NULL;
+    /*axis2_svc_grp_t *svc_grp = NULL;
+    axis2_svc_t *svc = NULL;
     axis2_char_t *svc_grp_name_str = NULL;
     axis2_char_t *svc_name_str = NULL;
     axis2_char_t *op_name_str = NULL;
-    axis2_char_t *op_mep_str = NULL;
+    axis2_op_t *op = NULL;
+    axis2_char_t *op_mep_str = NULL;*/
     axis2_char_t *to_url_str = NULL;
     axis2_char_t *reply_to_str = NULL;
     axis2_char_t *transport_to_str = NULL;
     axis2_char_t *persistent_prop_str = NULL;
     axis2_transport_out_desc_t *transport_out_desc = NULL;
     axis2_endpoint_ref_t *endpoint_ref = NULL;
-    axis2_op_t *op = NULL;
     axiom_xml_reader_t *reader = NULL;
     int soap_version = -1;
     axiom_stax_builder_t *om_builder = NULL;
     axiom_soap_builder_t *soap_builder = NULL;
     axiom_soap_envelope_t *soap_envelope = NULL;
     sandesha2_msg_store_bean_t *msg_store_bean = NULL;
+    axis2_char_t *soap_env_str = NULL;
 
     storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
     /*if(!persistent)
@@ -429,8 +452,10 @@
 
     msg_ctx = axis2_msg_ctx_create(env, conf_ctx, NULL, NULL);
     soap_env_str = axutil_strdup(env, 
sandesha2_msg_store_bean_get_soap_envelope_str(msg_store_bean, env));
-    reader = axiom_xml_reader_create_for_memory(env, soap_env_str, 
axutil_strlen(soap_env_str), NULL, 
-            AXIS2_XML_PARSER_TYPE_BUFFER);
+    axutil_array_list_add(storage_mgr_impl->envelope_buffer_list, env, 
soap_env_str); 
+
+    reader = axiom_xml_reader_create_for_memory(env, soap_env_str, 
axutil_strlen(soap_env_str), 
+            NULL, AXIS2_XML_PARSER_TYPE_BUFFER);
 
     om_builder = axiom_stax_builder_create(env, reader);
     soap_version = sandesha2_msg_store_bean_get_soap_version(msg_store_bean, 
env);
@@ -445,11 +470,17 @@
         soap_builder = axiom_soap_builder_create(env, om_builder,
             AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
     }
-
+    
     soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
     if (!soap_envelope)
     {
         axiom_soap_builder_free(soap_builder, env);
+        
+        if(msg_store_bean)
+        {
+            sandesha2_msg_store_bean_free(msg_store_bean, env);
+        }
+
         return NULL;
     }
 
@@ -463,7 +494,7 @@
     transport_out_desc = axis2_conf_get_transport_out(conf, env, 
transport_out);
     axis2_msg_ctx_set_transport_out_desc(msg_ctx, env, transport_out_desc);
 
-    svc_grp_name_str = sandesha2_msg_store_bean_get_svc_grp(msg_store_bean, 
env);
+    /*svc_grp_name_str = sandesha2_msg_store_bean_get_svc_grp(msg_store_bean, 
env);
     if(svc_grp_name_str)
     {
         svc_grp = axis2_conf_get_svc_grp(conf, env, svc_grp_name_str);
@@ -488,8 +519,8 @@
         }
     }
 
-    op_name_str = sandesha2_msg_store_bean_get_op(msg_store_bean, env);
     op_mep_str = sandesha2_msg_store_bean_get_op_mep(msg_store_bean, env);
+    op_name_str = sandesha2_msg_store_bean_get_op(msg_store_bean, env);
     svc = axis2_msg_ctx_get_svc(msg_ctx, env);
     if((op_name_str || op_mep_str) && svc)
     {
@@ -509,7 +540,7 @@
             axutil_hash_t *all_ops = NULL;
             axutil_hash_index_t *index = NULL;
 
-            /* Finding an operation using the MEP */
+            //Finding an operation using the MEP
             all_ops = axis2_svc_get_all_ops(svc, env);
             for (index = axutil_hash_first(all_ops, env); index; index = 
                 axutil_hash_next(env, index))
@@ -537,19 +568,19 @@
         {
             AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI, 
                     "[sandesha2] Cannot find a suitable operation for the 
generated message");
-            /*AXIS2_ERROR_SET(env->error, 
-                SANDESHA2_ERROR_CANNOT_FIND_OP_FOR_GENERATED_MSG, 
AXIS2_FAILURE);
-            axiom_soap_builder_free(soap_builder, env);
-            return NULL;*/
         }
     }
 
-    /* Setting contexts TODO is this necessary? */
+    // Setting contexts TODO is this necessary?
     svc_grp = axis2_msg_ctx_get_svc_grp(msg_ctx, env);
     if(svc_grp)
     {
+        const axis2_char_t *svc_grp_id = NULL;
+
         axis2_svc_grp_ctx_t *svc_grp_ctx = axis2_svc_grp_ctx_create(env, 
svc_grp, conf_ctx);
         axis2_msg_ctx_set_svc_grp_ctx(msg_ctx, env, svc_grp_ctx);
+        svc_grp_id = axis2_svc_grp_ctx_get_id(svc_grp_ctx, env);
+        axis2_conf_ctx_register_svc_grp_ctx(conf_ctx, env, svc_grp_id, 
svc_grp_ctx);
     }
 
     svc = axis2_msg_ctx_get_svc(msg_ctx, env);
@@ -559,13 +590,17 @@
         axis2_svc_ctx_t *svc_ctx = axis2_svc_ctx_create(env, svc, svc_grp_ctx);
         if(svc_ctx)
         {
+            const axis2_char_t *svc_id = NULL;
+
             axis2_svc_ctx_set_parent(svc_ctx, env, svc_grp_ctx);
             axis2_msg_ctx_set_svc_ctx(msg_ctx, env, svc_ctx);
+            svc_id = axis2_svc_ctx_get_svc_id(svc_ctx, env);
+            axis2_conf_ctx_register_svc_ctx(conf_ctx, env, svc_id, svc_ctx);
         }
     }
 
     op = axis2_msg_ctx_get_op(msg_ctx, env);
-    /*if(op)
+    if(op)
     {
                axis2_op_ctx_t *op_ctx = NULL;
         axis2_svc_ctx_t *svc_ctx = axis2_msg_ctx_get_svc_ctx(msg_ctx, env);
@@ -630,6 +665,8 @@
                 property = (axutil_property_t *) v;
                 axis2_msg_ctx_set_property(msg_ctx, env, key, property);
             }
+
+            axutil_hash_free(map, env);
         }
     }
 
@@ -958,29 +995,51 @@
     const axutil_env_t *env,
     axis2_char_t *str)
 {
+    axutil_array_list_t *values = NULL;
     int i = 0, size = 0;
     axutil_hash_t *map = axutil_hash_make(env);
-    axutil_array_list_t *values = sandesha2_utils_split(env, str, 
-        SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR);
+    values = sandesha2_utils_split(env, str, 
SANDESHA2_PERSISTANT_PROPERTY_SEPERATOR);
     if(values)
+    {
         size = axutil_array_list_size(values, env);
+    }
+
     if((size % 2 != 0) || (size == 1 && 0 == axutil_strcmp("", 
         axutil_array_list_get(values, env, 0))))
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Invalid persistence property string");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Invalid 
persistence property string");
         AXIS2_ERROR_SET(env->error, 
             SANDESHA2_ERROR_INVALID_PERSISTENCE_PROPERTY_STRING, 
AXIS2_FAILURE);
+
+        if(values)
+        {
+            int i = 0, size = 0;
+
+            size = axutil_array_list_size(values, env);
+            for(i = 0; i < size; i++)
+            {
+                axis2_char_t *value = axutil_array_list_get(values, env, i);
+                AXIS2_FREE(env->allocator, value);
+            }
+
+            axutil_array_list_free(values, env);
+        }
         return NULL;
     }
+
     for(i = 0; i < size; i=i+2)
     {
         axis2_char_t *key = axutil_array_list_get(values, env, i);
         axis2_char_t *value = axutil_array_list_get(values, env, i+1);
-        axutil_property_t *property = axutil_property_create_with_args(env, 0, 
-            0, 0, value);
+        axutil_property_t *property = axutil_property_create_with_args(env, 0, 
AXIS2_TRUE, 0, value);
         axutil_hash_set(map, key, AXIS2_HASH_KEY_STRING, property);
     }
+
+    if(values)
+    {
+        axutil_array_list_free(values, env);
+    }
+
     return map;
 }
 

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/ack_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/ack_mgr.c?rev=681448&r1=681447&r2=681448&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/ack_mgr.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/ack_mgr.c
 Thu Jul 31 12:29:19 2008
@@ -303,7 +303,7 @@
 
     if(found_list)
     {
-        int i = 0, size = 0;
+        int i = 0, j = 0, size = 0;
 
         size = axutil_array_list_size(found_list, env);
         for(i = 0; i < size; i++)
@@ -314,7 +314,7 @@
             timenow = sandesha2_utils_get_current_time_in_millis(env);
             sender_bean = axutil_array_list_get(found_list, env, i);
             
-            if(sandesha2_sender_bean_get_time_to_send(sender_bean, env) <= 
timenow)
+            if(sender_bean && 
sandesha2_sender_bean_get_time_to_send(sender_bean, env) <= timenow)
             {
                 axis2_msg_ctx_t *ack_msg_ctx = NULL;
                 axis2_char_t *to = NULL;
@@ -342,6 +342,8 @@
                     {
                         axis2_msg_ctx_free(ack_msg_ctx, env);
                     }
+                
+                    sandesha2_sender_bean_free(sender_bean, env);
                     continue;
                 }
 
@@ -351,6 +353,8 @@
                     {
                         axis2_msg_ctx_free(ack_msg_ctx, env);
                     }
+                    
+                    sandesha2_sender_bean_free(sender_bean, env);
                     continue; 
                 }
 
@@ -373,6 +377,7 @@
                         sandesha2_msg_ctx_free(ack_rm_msg_ctx, env);
                     }
 
+                    sandesha2_sender_bean_free(sender_bean, env);
                     continue;
                 }
 
@@ -393,9 +398,23 @@
                     sandesha2_msg_ctx_free(ack_rm_msg_ctx, env);
                 }
 
+                sandesha2_sender_bean_free(sender_bean, env);
                 break;
             }
 
+            for(j = i++; j < size; j++)
+            {
+                sandesha2_sender_bean_t *sender_bean = NULL;
+                
+                sender_bean = axutil_array_list_get(found_list, env, j);
+
+                if(sender_bean)
+                {
+                    sandesha2_sender_bean_free(sender_bean, env);
+                    sender_bean = NULL;
+                }
+            }
+
             if(sender_bean)
             {
                 sandesha2_sender_bean_free(sender_bean, env);

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_retrans_adjuster.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_retrans_adjuster.c?rev=681448&r1=681447&r2=681448&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_retrans_adjuster.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_retrans_adjuster.c
 Thu Jul 31 12:29:19 2008
@@ -60,7 +60,6 @@
 {
     axis2_char_t *stored_key = NULL;
     axis2_msg_ctx_t *msg_ctx = NULL;
-    sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
     axis2_char_t *internal_sequence_id = NULL;
     sandesha2_property_bean_t *property_bean = NULL;
     int max_attempts = -1;
@@ -88,10 +87,6 @@
 
     msg_ctx = sandesha2_storage_mgr_retrieve_msg_ctx(storage_mgr, env, 
stored_key, conf_ctx, 
             AXIS2_FALSE);
-    if(msg_ctx)
-    {
-        rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
-    }
 
     internal_sequence_id = 
sandesha2_sender_bean_get_internal_seq_id(sender_bean, env);
    
@@ -106,11 +101,8 @@
         timeout_seq = AXIS2_TRUE;
     }
 
-    if(rm_msg_ctx)
-    {
-        seq_timed_out = sandesha2_seq_mgr_has_seq_timedout(env, 
internal_sequence_id, rm_msg_ctx, 
-                seq_prop_mgr, conf_ctx);
-    }
+    seq_timed_out = sandesha2_seq_mgr_has_seq_timedout(env, 
internal_sequence_id, seq_prop_mgr, 
+            conf_ctx);
     
     if(seq_timed_out)
     {
@@ -132,11 +124,6 @@
         axis2_msg_ctx_free(msg_ctx, env);
     }
 
-    if(rm_msg_ctx)
-    {
-        sandesha2_msg_ctx_free(rm_msg_ctx, env);
-    }
-
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
             "[sandesha2] Exit:sandesha2_msg_retrans_adjuster_adjust_retrans");
 

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=681448&r1=681447&r2=681448&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
 Thu Jul 31 12:29:19 2008
@@ -1164,18 +1164,25 @@
     axis2_char_t *ptr = NULL;
     axis2_char_t *value = NULL;
     ptr = axutil_strstr(str, pattern);
+
     while(ptr)
     {
         ptr[0] = AXIS2_EOLN;
         value = axutil_strdup(env, str);
-        if(value && 0 != axutil_strcmp(value, ""))
+        if(value && axutil_strcmp(value, ""))
+        {
             axutil_array_list_add(list, env, value);
+        }
+
         str = ptr + 3;
         ptr = axutil_strstr(str, pattern);
     }
+
     value = axutil_strdup(env, str);
-    if(value && 0 != axutil_strcmp(value, ""))
+    if(value && axutil_strcmp(value, ""))
+    {
         axutil_array_list_add(list, env, value);
+    }
 
     return list;
 }

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=681448&r1=681447&r2=681448&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
 Thu Jul 31 12:29:19 2008
@@ -254,7 +254,6 @@
 sandesha2_seq_mgr_has_seq_timedout(
     const axutil_env_t *env,
     axis2_char_t *property_key,
-    sandesha2_msg_ctx_t *rm_msg_ctx,
     sandesha2_seq_property_mgr_t *seq_prop_mgr,
     axis2_conf_ctx_t *conf_ctx)
 {
@@ -267,13 +266,8 @@
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] 
Entry:sandesha2_seq_mgr_has_seq_timedout");
 
     AXIS2_PARAM_CHECK(env->error, property_key, AXIS2_FALSE);
-    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FALSE);
     AXIS2_PARAM_CHECK(env->error, seq_prop_mgr, AXIS2_FALSE);
     
-    /* Avoid retrieving property bean from operation until it is availbale */
-    /*property_bean = sandesha2_utils_get_property_bean_from_op(env, 
axis2_msg_ctx_get_op(
-     * sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env), env));*/
-
     property_bean = sandesha2_utils_get_property_bean(env, 
axis2_conf_ctx_get_conf(conf_ctx, env));
     timeout_interval = 
sandesha2_property_bean_get_inactive_timeout_interval(property_bean, env);
     if(timeout_interval <= 0)



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to