Author: damitha
Date: Thu May  8 21:55:09 2008
New Revision: 654683

URL: http://svn.apache.org/viewvc?rev=654683&view=rev
Log:
Fixing SANDESHA2C-50

Modified:
    webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.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=654683&r1=654682&r2=654683&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 May  8 21:55:09 2008
@@ -180,6 +180,7 @@
     sandesha2_msg_ctx_t *fault_ctx = NULL;
     axis2_char_t *spec_version = NULL;
     axis2_char_t *dbname = NULL;
+    sandesha2_seq_ack_t *seq_ack = NULL;
   
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
         
"[sandesha2]Entry:sandesha2_terminate_seq_msg_processor_process_in_msg");
@@ -251,63 +252,61 @@
         sandesha2_terminate_seq_msg_processor_add_terminate_seq_res(env, 
             rm_msg_ctx, seq_id, seq_prop_mgr);
     }
-    else
+    seq_ack = sandesha2_msg_ctx_get_seq_ack(rm_msg_ctx, env);
+    if(seq_ack)
     {
-        sandesha2_seq_ack_t *seq_ack = NULL;
-
-        seq_ack = sandesha2_msg_ctx_get_seq_ack(rm_msg_ctx, env);
-        if(seq_ack)
+        axis2_char_t *int_seq_id = NULL;
+        axis2_char_t *out_seq_id = NULL;
+        axis2_char_t *last_out_msg_no_str = NULL;
+        long highest_out_msg_no = 0;
+        
+        /* 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.
+         */
+        out_seq_id = sandesha2_identifier_get_identifier(
+            sandesha2_seq_ack_get_identifier(seq_ack, env), env);
+        int_seq_id = sandesha2_utils_get_seq_property(env, out_seq_id, 
+                SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID, seq_prop_mgr);
+        last_out_msg_no_str = sandesha2_utils_get_seq_property(env, int_seq_id,
+            SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NO, seq_prop_mgr);
+        if(last_out_msg_no_str)
         {
-            axis2_char_t *int_seq_id = NULL;
-            axis2_char_t *out_seq_id = NULL;
-            axis2_char_t *last_out_msg_no_str = NULL;
-            long highest_out_msg_no = 0;
-            
-            /* 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.
-             */
-            out_seq_id = sandesha2_identifier_get_identifier(
-                sandesha2_seq_ack_get_identifier(seq_ack, env), env);
-            int_seq_id = sandesha2_utils_get_seq_property(env, out_seq_id, 
-                    SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID, seq_prop_mgr);
-            last_out_msg_no_str = sandesha2_utils_get_seq_property(env, 
int_seq_id,
-                SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NO, seq_prop_mgr);
+            highest_out_msg_no = atol(last_out_msg_no_str);
             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, 
-                    int_seq_id, seq_prop_mgr);
-            }
-            if(highest_out_msg_no > 0)
-            {
-                axis2_bool_t completed = AXIS2_FALSE;
-                axutil_array_list_t *ack_range_list = NULL;
+                AXIS2_FREE(env->allocator, last_out_msg_no_str);
+        }
+        else
+        {
+            highest_out_msg_no = 
sandesha2_app_msg_processor_get_prev_msg_no(env, 
+                int_seq_id, seq_prop_mgr);
+        }
+        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);
-                if(completed)
-                {
-                    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                            "[sandesha2]Sequence %s is completed. So adding 
terminate msg", 
-                            out_seq_id); 
-                    sandesha2_terminate_mgr_add_terminate_seq_msg(env, 
rm_msg_ctx, 
-                        out_seq_id, int_seq_id, storage_mgr, seq_prop_mgr, 
-                        create_seq_mgr, sender_mgr);
-                }
+            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", 
+                        out_seq_id); 
+                sandesha2_terminate_mgr_add_terminate_seq_msg(env, rm_msg_ctx, 
+                    out_seq_id, int_seq_id, storage_mgr, seq_prop_mgr, 
+                    create_seq_mgr, sender_mgr);
             }
         }
     }
-    sandesha2_terminate_seq_msg_processor_setup_highest_msg_nums(env, 
conf_ctx, 
-        storage_mgr, seq_id, rm_msg_ctx, seq_prop_mgr, create_seq_mgr, 
-        sender_mgr);
+    else
+    {
+        sandesha2_terminate_seq_msg_processor_setup_highest_msg_nums(env, 
conf_ctx, 
+            storage_mgr, seq_id, rm_msg_ctx, seq_prop_mgr, create_seq_mgr, 
+            sender_mgr);
+    }
     sandesha2_terminate_mgr_clean_recv_side_after_terminate_msg(env, conf_ctx,
         seq_id, storage_mgr, seq_prop_mgr, next_msg_mgr);
     /*transmit_bean = sandesha2_seq_property_bean_create_with_data(env, seq_id,



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

Reply via email to