You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2008/08/13 05:53:56 UTC

svn commit: r685430 - in /webservices/axis2/trunk/c: include/axis2_msg_ctx.h src/core/context/msg_ctx.c

Author: damitha
Date: Tue Aug 12 20:53:55 2008
New Revision: 685430

URL: http://svn.apache.org/viewvc?rev=685430&view=rev
Log:
Adding ref counter to message context. This is needed for Sandesha2/C

Modified:
    webservices/axis2/trunk/c/include/axis2_msg_ctx.h
    webservices/axis2/trunk/c/src/core/context/msg_ctx.c

Modified: webservices/axis2/trunk/c/include/axis2_msg_ctx.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_msg_ctx.h?rev=685430&r1=685429&r2=685430&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_msg_ctx.h (original)
+++ webservices/axis2/trunk/c/include/axis2_msg_ctx.h Tue Aug 12 20:53:55 2008
@@ -2074,6 +2074,20 @@
         const axutil_env_t * env,
         axutil_array_list_t *mime_parts);
 
+    /**
+     * Incrementing the msg_ctx ref count. This is necessary when 
+     * prevent freeing msg_ctx through op_client when it is in use 
+     * as in sandesha2.
+     * @param msg_ctx pointer to message context  
+     * @param env pointer to environment struct
+     * @return AXIS2_TRUE if still in use, else AXIS2_FALSE 
+     */
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axis2_msg_ctx_increment_ref(
+        axis2_msg_ctx_t * msg_ctx,
+        const axutil_env_t * env);
+
+
 
 /** @} */
 

Modified: webservices/axis2/trunk/c/src/core/context/msg_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/context/msg_ctx.c?rev=685430&r1=685429&r2=685430&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/context/msg_ctx.c (original)
+++ webservices/axis2/trunk/c/src/core/context/msg_ctx.c Tue Aug 12 20:53:55 2008
@@ -218,6 +218,7 @@
     axis2_bool_t no_content;
 
     axutil_array_list_t *mime_parts;
+    int ref;
 };
 
 AXIS2_EXTERN axis2_msg_ctx_t *AXIS2_CALL
@@ -329,6 +330,7 @@
         return NULL;
     }
     msg_ctx->msg_info_headers_deep_copy = AXIS2_TRUE;
+    msg_ctx->ref = 1;
 
     return msg_ctx;
 }
@@ -371,6 +373,11 @@
     axis2_msg_ctx_t * msg_ctx,
     const axutil_env_t * env)
 {
+    if (--(msg_ctx->ref) > 0)
+    {
+        return;
+    }
+
     if (msg_ctx->keep_alive)
     {
         return;
@@ -548,6 +555,15 @@
     return;
 }
 
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_msg_ctx_increment_ref(
+    axis2_msg_ctx_t * msg_ctx,
+    const axutil_env_t * env)
+{
+    msg_ctx->ref++;
+    return AXIS2_SUCCESS;
+}
+
 axis2_status_t AXIS2_CALL
 axis2_msg_ctx_init(
     struct axis2_msg_ctx * msg_ctx,