Author: damitha
Date: Wed May  7 10:35:20 2008
New Revision: 654187

URL: http://svn.apache.org/viewvc?rev=654187&view=rev
Log:
Fixing Sandesha2c-50. Need testing.

Modified:
    webservices/sandesha/trunk/c/src/msgprocessors/ack_msg_processor.c
    webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
    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/ack_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/ack_msg_processor.c?rev=654187&r1=654186&r2=654187&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/ack_msg_processor.c 
(original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/ack_msg_processor.c Wed May  
7 10:35:20 2008
@@ -427,8 +427,9 @@
                 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); 
+                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);

Modified: webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c?rev=654187&r1=654186&r2=654187&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c 
(original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Wed May  
7 10:35:20 2008
@@ -232,6 +232,7 @@
     axis2_op_t *op = NULL;
     int mep = -1;
     axis2_char_t *dbname = NULL;
+    axis2_char_t *last_out_msg_no_str = NULL;
    
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
@@ -618,10 +619,44 @@
         wsa_action) || 0 == axutil_strcmp(
         SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE, soap_action)) 
     {
+        sandesha2_seq_ack_t *seq_ack = NULL;
+
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
             "[sandesha2]Got WSRM 1.0 last message, aborting");
-        sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, 
msgs_str, 
-            storage_mgr, sender_mgr, seq_prop_mgr);
+        /*sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, 
msgs_str, 
+            storage_mgr, sender_mgr, seq_prop_mgr);*/
+
+        seq_ack = sandesha2_msg_ctx_get_seq_ack(rm_msg_ctx, env);
+        if(seq_ack)
+        {
+            /* 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.
+             */
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "last_msg_no:%ld", msg_no);
+            if(msg_no > 0) /* msg_no is the current message number */
+            {
+                axis2_bool_t completed = AXIS2_FALSE;
+                axutil_array_list_t *ack_range_list = NULL;
+
+                ack_range_list = sandesha2_seq_ack_get_ack_range_list(seq_ack, 
env);
+                completed = sandesha2_ack_mgr_verify_seq_completion(env, 
+                    ack_range_list, msg_no);
+                if(completed)
+                {
+                    axis2_char_t *int_seq_id = NULL;
+
+                    int_seq_id = sandesha2_utils_get_seq_property(env, 
str_seq_id, 
+                        SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID, seq_prop_mgr);
+                    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                            "[sandesha2]Sequence %s is completed. So adding 
terminate msg", 
+                            str_seq_id); 
+                    sandesha2_terminate_mgr_add_terminate_seq_msg(env, 
rm_msg_ctx, 
+                        str_seq_id, int_seq_id, storage_mgr, seq_prop_mgr, 
+                        create_seq_mgr, sender_mgr);
+                }
+            }
+        }
+
         sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
         if(seq_prop_mgr)
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
@@ -790,6 +825,9 @@
     }
     if(back_channel_free)
     {
+        /* MEP is in only or duplex mode anonymous reply to address.
+         * That means we can send an acknowledgment message in the http back 
channel.
+         */
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
             "[sandesha2]back_channel_free true");
         sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, 
msgs_str, 
@@ -797,11 +835,16 @@
     }
     else if(sandesha2_utils_is_single_channel(env, rm_version, acks_to_str))
     {
+        /* This means acknowledgment address is anomymous and RM version is 
1.0.
+         * In other words single channel duplex mode. In this case we do not 
send the
+         * acknowledgment message here. Instead we send it in the message out 
path.
+         * See sandesha2_app_msg_processor_process_response_msg() code.
+         */
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]is_single_channel 
true");
-        /* Do nothing */
     } 
     else
     {
+        /* This is most probably dual channel duplex mode. */
         sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, 
msgs_str, 
             storage_mgr, sender_mgr, seq_prop_mgr);
     }
@@ -1114,7 +1157,7 @@
     {
         sandesha2_seq_property_bean_t *res_highest_msg_key_bean = NULL;
         sandesha2_seq_property_bean_t *res_last_msg_key_bean = NULL;
-        
+       
         res_highest_msg_key_bean = 
sandesha2_seq_property_bean_create_with_data(
             env, internal_seq_id, SANDESHA2_SEQ_PROP_HIGHEST_OUT_MSG_KEY,
             storage_key);
@@ -1883,7 +1926,10 @@
         if(req_rm_msg_ctx)
             sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
         engine = axis2_engine_create(env, conf_ctx);
-        return axis2_engine_resume_send(engine, env, msg_ctx);
+        status = axis2_engine_resume_send(engine, env, msg_ctx);
+        if(engine)
+            axis2_engine_free(engine, env);
+        return status;
     }
     if(rm_version)
         AXIS2_FREE(env->allocator, rm_version);

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=654187&r1=654186&r2=654187&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 
Wed May  7 10:35:20 2008
@@ -168,7 +168,6 @@
     sandesha2_msg_ctx_t *rm_msg_ctx)
 {
     axis2_msg_ctx_t *msg_ctx = NULL;
-    sandesha2_seq_ack_t *seq_ack = NULL;
     sandesha2_terminate_seq_t *term_seq = NULL;
     axis2_char_t *seq_id = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
@@ -181,24 +180,17 @@
     axis2_char_t *spec_version = NULL;
     axis2_char_t *dbname = NULL;
   
-    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
         
"[sandesha2]Entry:sandesha2_terminate_seq_msg_processor_process_in_msg");
+    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
+
     msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
     
-    seq_ack = sandesha2_msg_ctx_get_seq_ack(rm_msg_ctx, env);
-    
-    if(seq_ack)
-    {
-        sandesha2_msg_processor_t *ack_processor = NULL;
-        ack_processor = sandesha2_ack_msg_processor_create(env);
-        sandesha2_msg_processor_process_in_msg(ack_processor, env, rm_msg_ctx);
-    }
     term_seq = sandesha2_msg_ctx_get_terminate_seq(rm_msg_ctx, env);
     if(!term_seq)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Terminate "
-            "Sequence part is not available");
+        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;
@@ -207,8 +199,7 @@
         sandesha2_terminate_seq_get_identifier(term_seq, env), env);
     if(!seq_id || 0 == axutil_strlen(seq_id))
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Invalid "
-            "sequence id");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Invalid sequence 
id");
         return AXIS2_FAILURE;
     }
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);

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=654187&r1=654186&r2=654187&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/terminate_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/terminate_mgr.c Wed May  7 10:35:20 
2008
@@ -784,9 +784,14 @@
     }
     
     sandesha2_msg_ctx_add_soap_envelope(terminate_rm_msg, env);
+    /* If server side and single channel duplex mode send the terminate 
sequence
+     * message.
+     */
     if(axis2_msg_ctx_get_server_side(msg_ctx, env) &&
        sandesha2_utils_is_single_channel(env, rm_ver, to_addr))
     {
+        /* Send an acknowledgement message with the terminate message 
sequence. */
+        sandesha2_msg_creator_add_ack_msg(env, rm_msg_ctx, out_seq_id, 
seq_prop_mgr);
         axis2_msg_ctx_t *msg_ctx2 = 
sandesha2_msg_ctx_get_msg_ctx(terminate_rm_msg, env);
         axis2_bool_t is_svr_side = axis2_msg_ctx_get_server_side(msg_ctx2, 
env);
         axis2_op_ctx_set_response_written(axis2_msg_ctx_get_op_ctx(msg_ctx2, 
env), env, AXIS2_TRUE);



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

Reply via email to