axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r389390 - in /webservices/axis2/trunk/c: include/axis2_http_client.h include/axis2_msg_ctx.h modules/core/transport/http/sender/http_client.c modules/core/transport/http/sender/soap_over_http_sender.c modules/util/stream.c
Date Tue, 28 Mar 2006 04:20:50 GMT
Author: sahan
Date: Mon Mar 27 20:20:49 2006
New Revision: 389390

URL: http://svn.apache.org/viewcvs?rev=389390&view=rev
Log:
Cleaning http_client mem leak

Modified:
    webservices/axis2/trunk/c/include/axis2_http_client.h
    webservices/axis2/trunk/c/include/axis2_msg_ctx.h
    webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c
    webservices/axis2/trunk/c/modules/util/stream.c

Modified: webservices/axis2/trunk/c/include/axis2_http_client.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_http_client.h?rev=389390&r1=389389&r2=389390&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_client.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_client.h Mon Mar 27 20:20:49 2006
@@ -87,6 +87,14 @@
 AXIS2_DECLARE(axis2_http_client_t *) 
 axis2_http_client_create (axis2_env_t **env, axis2_url_t *url);
 
+/**
+ * Free http_client passed as void pointer. This will be
+ * cast into appropriate type and then pass the cast object
+ * into the http_client structure's free method
+ */
+axis2_status_t AXIS2_CALL
+axis2_http_client_free_void_arg (void *client, axis2_env_t **env);
+
 /************************** Start of function macros **************************/
 
 #define AXIS2_HTTP_CLIENT_SEND(client, env, request) \
@@ -106,7 +114,6 @@
                                 ((client)->ops->get_url(client, env))
 #define AXIS2_HTTP_CLIENT_FREE(client, env) \
                                 ((client)->ops->free(client, env))
-
 /************************** End of function macros ****************************/    
 
 /** @} */

Modified: webservices/axis2/trunk/c/include/axis2_msg_ctx.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_msg_ctx.h?rev=389390&r1=389389&r2=389390&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_msg_ctx.h (original)
+++ webservices/axis2/trunk/c/include/axis2_msg_ctx.h Mon Mar 27 20:20:49 2006
@@ -58,6 +58,8 @@
 #define AXIS2_DEFAULT_CHAR_SET_ENCODING "UTF-8"
 /** axis2 transport succeeded */
 #define AXIS2_TRANSPORT_SUCCEED "AXIS2_TRANSPORT_SUCCEED"
+/* HTTP Client */
+#define AXIS2_HTTP_CLIENT "AXIS2_HTTP_CLIENT"
 
 #define AXIS2_TRANSPORT_URL "TransportURL"
     

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c?rev=389390&r1=389389&r2=389390&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c Mon Mar 27
20:20:49 2006
@@ -53,21 +53,28 @@
 int AXIS2_CALL 
 axis2_http_client_recieve_header (axis2_http_client_t *client, 
 						axis2_env_t **env);
+
 axis2_http_simple_response_t* AXIS2_CALL 
 axis2_http_client_get_response (axis2_http_client_t *client, axis2_env_t **env);
+
 axis2_status_t AXIS2_CALL 
 axis2_http_client_set_url (axis2_http_client_t *client, 
 						axis2_env_t **env, axis2_url_t *url);
 axis2_url_t* AXIS2_CALL 
 axis2_http_client_get_url (axis2_http_client_t *client, axis2_env_t **env);
+
 axis2_status_t AXIS2_CALL 
 axis2_http_client_set_timeout (axis2_http_client_t *client, axis2_env_t **env, 
 						int timeout_ms);
+
 int AXIS2_CALL 
 axis2_http_client_get_timeout (axis2_http_client_t *client, axis2_env_t **env);
 
 axis2_status_t AXIS2_CALL 
-axis2_http_client_free (axis2_http_client_t *client, axis2_env_t **env);							
+axis2_http_client_free (axis2_http_client_t *client, axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL
+axis2_http_client_free_void_arg (void *client, axis2_env_t **env);							
 
 /***************************** End of function headers ************************/
 
@@ -131,11 +138,6 @@
         AXIS2_URL_FREE(http_client_impl->url, env);
         http_client_impl->url = NULL;
     }
-    if(NULL != http_client_impl->data_stream)
-    {
-        AXIS2_STREAM_FREE(http_client_impl->data_stream, env);
-        http_client_impl->data_stream = NULL;
-    }
 	if(NULL != http_client_impl->response)
     {
         AXIS2_HTTP_SIMPLE_RESPONSE_FREE(http_client_impl->response, env);
@@ -151,6 +153,16 @@
     
 	AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(client));
 	return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_http_client_free_void_arg (void *client, axis2_env_t **env)
+{
+    axis2_http_client_t *client_l = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    client_l = (axis2_http_client_t *)client;
+    return axis2_http_client_free(client_l, env);
 }
 
 

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c?rev=389390&r1=389389&r2=389390&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c Mon
Mar 27 20:20:49 2006
@@ -158,6 +158,10 @@
     if(NULL != sender->ops)
         AXIS2_FREE((*env)->allocator, sender->ops);
     
+    /* Do not free this here since it will be required in later processing
+     * of the response soap message
+     */
+    sender_impl->client = NULL;
 	AXIS2_FREE((*env)->allocator, sender_impl);
 	return AXIS2_SUCCESS;
 }
@@ -207,6 +211,16 @@
 	{
 		return AXIS2_FAILURE;
 	}
+    /* We put the client into msg_ctx so that we can free it once the processing
+     * is done at client side
+     */
+    property = axis2_property_create(env);
+    AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
+    AXIS2_PROPERTY_SET_FREE_FUNC(property, env, 
+                        axis2_http_client_free_void_arg);
+    AXIS2_PROPERTY_SET_VALUE(property, env, sender_impl->client);
+    AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_HTTP_CLIENT,
+                    property, AXIS2_TRUE);
 
 	if(NULL == sender_impl->om_output)
 	{

Modified: webservices/axis2/trunk/c/modules/util/stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/stream.c?rev=389390&r1=389389&r2=389390&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/stream.c (original)
+++ webservices/axis2/trunk/c/modules/util/stream.c Mon Mar 27 20:20:49 2006
@@ -44,6 +44,10 @@
 axis2_status_t AXIS2_CALL 
 axis2_stream_free (axis2_stream_t *stream, axis2_env_t **env);
 
+axis2_status_t AXIS2_CALL
+axis2_stream_free_void_arg (void *stream,
+                            axis2_env_t **env);
+
 axis2_stream_type_t AXIS2_CALL 
 axis2_stream_get_type (axis2_stream_t *stream, axis2_env_t **env);
 



Mime
View raw message