svn commit: r692351 - in /webservices/sandesha/trunk/c/src: msgprocessors/terminate_seq_msg_processor.c util/terminate_mgr.c

[email protected]
Newsgroups gmane.comp.apache.webservices.fx.devel
Message-ID <[email protected]>
Author: damitha
Date: Thu Sep  4 23:48:28 2008
New Revision: 692351

URL: http://svn.apache.org/viewvc?rev=692351&view=rev
Log:
Interop with .net

Modified:
    webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c
    webservices/sandesha/trunk/c/src/util/terminate_mgr.c

Modified: webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c?rev=692351&r1=692350&r2=692351&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c Thu Sep  4 23:48:28 2008
@@ -289,6 +289,7 @@
         axis2_char_t *rms_sequence_id = NULL;
         axis2_char_t *last_out_msg_no_str = NULL;
         long highest_out_msg_no = 0;
+        sandesha2_seq_property_bean_t *terminated_bean = NULL;
         
         /* If there is a sequence acknowledgement element present in the sequence we will check
          * whether the sequence is completed. If so send a terminate sequence message.
@@ -299,49 +300,66 @@
         internal_sequence_id = sandesha2_utils_get_seq_property(env, rms_sequence_id, 
                 SANDESHA2_SEQUENCE_PROPERTY_RMS_INTERNAL_SEQ_ID, seq_prop_mgr);
 
-        last_out_msg_no_str = sandesha2_utils_get_seq_property(env, internal_sequence_id,
-            SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NO, seq_prop_mgr);
-
-        if(last_out_msg_no_str)
+        terminated_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_sequence_id, 
+                SANDESHA2_SEQ_PROP_TERMINATE_ADDED);
+        if(terminated_bean)
         {
-            highest_out_msg_no = atol(last_out_msg_no_str);
-            if(last_out_msg_no_str)
+            axis2_char_t *value = sandesha2_seq_property_bean_get_value(terminated_bean, env);
+
+            if(value && !axutil_strcmp(AXIS2_VALUE_TRUE, value))
             {
-                AXIS2_FREE(env->allocator, last_out_msg_no_str);
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                    "[sandesha2] Terminate sequence message was added previously");
             }
+
+            sandesha2_seq_property_bean_free(terminated_bean, env);
         }
         else
         {
-            highest_out_msg_no = sandesha2_app_msg_processor_get_prev_msg_no(env, 
+            last_out_msg_no_str = sandesha2_utils_get_seq_property(env, internal_sequence_id,
+                SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NO, seq_prop_mgr);
+
+            if(last_out_msg_no_str)
+            {
+                highest_out_msg_no = atol(last_out_msg_no_str);
+                if(last_out_msg_no_str)
+                {
+                    AXIS2_FREE(env->allocator, last_out_msg_no_str);
+                }
+            }
+            else
+            {
+                highest_out_msg_no = sandesha2_app_msg_processor_get_prev_msg_no(env, 
                     internal_sequence_id, seq_prop_mgr);
-        }
+            }
 
-        if(highest_out_msg_no > 0)
-        {
-            axis2_bool_t completed = AXIS2_FALSE;
-            axutil_array_list_t *ack_range_list = NULL;
+            if(highest_out_msg_no > 0)
+            {
+                axis2_bool_t completed = AXIS2_FALSE;
+                axutil_array_list_t *ack_range_list = NULL;
 
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "highest_out_msg_no:%ld", highest_out_msg_no);
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "highest_out_msg_no:%ld", highest_out_msg_no);
 
-            ack_range_list = sandesha2_seq_ack_get_ack_range_list(seq_ack, env);
-            completed = sandesha2_ack_mgr_verify_seq_completion(env, ack_range_list, 
-                    highest_out_msg_no);
+                ack_range_list = sandesha2_seq_ack_get_ack_range_list(seq_ack, env);
+                completed = sandesha2_ack_mgr_verify_seq_completion(env, ack_range_list, 
+                        highest_out_msg_no);
+
+                if(completed)
+                {
+                    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                            "[sandesha2]Sequence %s is completed. So adding terminate msg", 
+                            rms_sequence_id); 
+
+                    sandesha2_terminate_mgr_send_terminate_seq_msg(env, rm_msg_ctx, rms_sequence_id, 
+                            internal_sequence_id, storage_mgr, seq_prop_mgr, create_seq_mgr, sender_mgr);
+                }
+            }
 
-            if(completed)
+            if(internal_sequence_id)
             {
-                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                        "[sandesha2]Sequence %s is completed. So adding terminate msg", 
-                        rms_sequence_id); 
-
-                sandesha2_terminate_mgr_send_terminate_seq_msg(env, rm_msg_ctx, rms_sequence_id, 
-                        internal_sequence_id, storage_mgr, seq_prop_mgr, create_seq_mgr, sender_mgr);
+                AXIS2_FREE(env->allocator, internal_sequence_id);
             }
         }
-
-        if(internal_sequence_id)
-        {
-            AXIS2_FREE(env->allocator, internal_sequence_id);
-        }
     }
     else
     {

Modified: webservices/sandesha/trunk/c/src/util/terminate_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/terminate_mgr.c?rev=692351&r1=692350&r2=692351&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/terminate_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/terminate_mgr.c Thu Sep  4 23:48:28 2008
@@ -829,7 +829,6 @@
     axis2_msg_ctx_t *ack_msg_ctx = NULL;
     axis2_msg_ctx_t *terminate_msg_ctx = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
-    sandesha2_seq_property_bean_t *terminated = NULL;
     sandesha2_msg_ctx_t *terminate_rm_msg_ctx = NULL;
     axutil_property_t *property = NULL;
     axis2_endpoint_ref_t *to_epr = NULL;
@@ -866,10 +865,10 @@
     ack_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(ack_rm_msg_ctx, env);
     conf_ctx = axis2_msg_ctx_get_conf_ctx(ack_msg_ctx, env);
     
-    terminated = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_sequence_id, 
+    /*terminated = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_sequence_id, 
             SANDESHA2_SEQ_PROP_TERMINATE_ADDED);
 
-    /*if(terminated)
+    if(terminated)
     {
         axis2_char_t *value = sandesha2_seq_property_bean_get_value(terminated, env);
 
@@ -1306,7 +1305,7 @@
     }
 
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-        "[sandesha2] Response envelope for CreateSequenceResponse message found");
+        "[sandesha2] Response envelope for TerminateSequenceResponse message found");
 
     response_msg_ctx = axis2_msg_ctx_create(env, conf_ctx, axis2_msg_ctx_get_transport_in_desc(msg_ctx, 
                 env), axis2_msg_ctx_get_transport_out_desc(msg_ctx, env));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.