axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shan...@apache.org
Subject svn commit: r805347 [28/31] - in /webservices/axis2/trunk/c/src: core/addr/ core/clientapi/ core/context/ core/deployment/ core/description/ core/engine/ core/phaseresolver/ core/receivers/ core/transport/amqp/receiver/ core/transport/amqp/receiver/qpi...
Date Tue, 18 Aug 2009 10:15:53 GMT
Modified: webservices/axis2/trunk/c/src/core/transport/tcp/receiver/simple_tcp_svr_conn.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/tcp/receiver/simple_tcp_svr_conn.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/tcp/receiver/simple_tcp_svr_conn.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/tcp/receiver/simple_tcp_svr_conn.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -36,10 +35,10 @@
 {
     axis2_simple_tcp_svr_conn_t *svr_conn = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    svr_conn = (axis2_simple_tcp_svr_conn_t *)
-        AXIS2_MALLOC(env->allocator, sizeof(axis2_simple_tcp_svr_conn_t));
+    svr_conn = (axis2_simple_tcp_svr_conn_t *)AXIS2_MALLOC(env->allocator,
+        sizeof(axis2_simple_tcp_svr_conn_t));
 
-    if (!svr_conn)
+    if(!svr_conn)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
@@ -48,13 +47,12 @@
     svr_conn->stream = NULL;
     svr_conn->buffer = NULL;
 
-    if (-1 != svr_conn->socket)
+    if(-1 != svr_conn->socket)
     {
         svr_conn->stream = axutil_stream_create_socket(env, svr_conn->socket);
-        if (!svr_conn->stream)
+        if(!svr_conn->stream)
         {
-            axis2_simple_tcp_svr_conn_free((axis2_simple_tcp_svr_conn_t *)
-                                           svr_conn, env);
+            axis2_simple_tcp_svr_conn_free((axis2_simple_tcp_svr_conn_t *)svr_conn, env);
             return NULL;
         }
     }
@@ -81,7 +79,7 @@
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     axutil_stream_free(svr_conn->stream, env);
-    if (-1 != svr_conn->socket)
+    if(-1 != svr_conn->socket)
     {
         axutil_network_handler_close_socket(env, svr_conn->socket);
         svr_conn->socket = -1;
@@ -95,7 +93,7 @@
     const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    if (-1 != svr_conn->socket)
+    if(-1 != svr_conn->socket)
     {
         return AXIS2_TRUE;
     }
@@ -123,15 +121,13 @@
     AXIS2_ENV_CHECK(env, NULL);
 
     memset(str_line, 0, size);
-    while ((read =
-            axutil_stream_peek_socket(svr_conn->stream, env, tmp_buf,
-                                      size - 1)) > 0)
+    while((read = axutil_stream_peek_socket(svr_conn->stream, env, tmp_buf, size - 1)) > 0)
     {
         tmp_buf[read] = '\0';
-        if (read > 0)
+        if(read > 0)
         {
             read = axutil_stream_read(svr_conn->stream, env, tmp_buf, size - 1);
-            if (read > 0)
+            if(read > 0)
             {
                 tmp_buf[read] = '\0';
                 strcat(str_line, tmp_buf);
@@ -143,7 +139,7 @@
             }
         }
     }
-    if (str_line > 0)
+    if(str_line > 0)
     {
         svr_conn->buffer = str_line;
     }
@@ -156,9 +152,7 @@
     const axutil_env_t * env,
     int timeout)
 {
-    return axutil_network_handler_set_sock_option(env,
-                                                  svr_conn->socket, SO_RCVTIMEO,
-                                                  timeout);
+    return axutil_network_handler_set_sock_option(env, svr_conn->socket, SO_RCVTIMEO, timeout);
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -167,9 +161,7 @@
     const axutil_env_t * env,
     int timeout)
 {
-    return axutil_network_handler_set_sock_option(env,
-                                                  svr_conn->socket, SO_SNDTIMEO,
-                                                  timeout);
+    return axutil_network_handler_set_sock_option(env, svr_conn->socket, SO_SNDTIMEO, timeout);
 }
 
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL

Modified: webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_receiver.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_receiver.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_receiver.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_receiver.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -38,25 +37,27 @@
     axis2_conf_ctx_t *conf_ctx;
     axis2_conf_ctx_t *conf_ctx_private;
     axis2_conf_t *conf;
-}
-axis2_tcp_server_impl_t;
+} axis2_tcp_server_impl_t;
 
 #define AXIS2_INTF_TO_IMPL(tcp_server) \
                 ((axis2_tcp_server_impl_t *)(tcp_server))
 
 /***************************** Function headers *******************************/
 
-axis2_status_t AXIS2_CALL axis2_tcp_server_init(
+axis2_status_t AXIS2_CALL
+axis2_tcp_server_init(
     axis2_transport_receiver_t * server,
     const axutil_env_t * env,
     axis2_conf_ctx_t * conf_ctx,
     axis2_transport_in_desc_t * in_desc);
 
-axis2_status_t AXIS2_CALL axis2_tcp_server_start(
+axis2_status_t AXIS2_CALL
+axis2_tcp_server_start(
     axis2_transport_receiver_t * server,
     const axutil_env_t * env);
 
-axis2_status_t AXIS2_CALL axis2_tcp_server_stop(
+axis2_status_t AXIS2_CALL
+axis2_tcp_server_stop(
     axis2_transport_receiver_t * server,
     const axutil_env_t * env);
 
@@ -69,7 +70,8 @@
     const axutil_env_t * env,
     const axis2_char_t * svc_name);
 
-axis2_bool_t AXIS2_CALL axis2_tcp_server_is_running(
+axis2_bool_t AXIS2_CALL
+axis2_tcp_server_is_running(
     axis2_transport_receiver_t * server,
     const axutil_env_t * env);
 
@@ -78,14 +80,9 @@
     const axutil_env_t * env);
 
 static const axis2_transport_receiver_ops_t tcp_transport_receiver_ops_var = {
-    axis2_tcp_server_init,
-    axis2_tcp_server_start,
-    axis2_tcp_server_get_reply_to_epr,
-    axis2_tcp_server_get_conf_ctx,
-    axis2_tcp_server_is_running,
-    axis2_tcp_server_stop,
-    axis2_tcp_server_free
-};
+    axis2_tcp_server_init, axis2_tcp_server_start, axis2_tcp_server_get_reply_to_epr,
+    axis2_tcp_server_get_conf_ctx, axis2_tcp_server_is_running, axis2_tcp_server_stop,
+    axis2_tcp_server_free };
 
 AXIS2_EXTERN axis2_transport_receiver_t *AXIS2_CALL
 axis2_tcp_server_create(
@@ -96,10 +93,10 @@
     axis2_tcp_server_impl_t *server_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
 
-    server_impl = (axis2_tcp_server_impl_t *) AXIS2_MALLOC
-        (env->allocator, sizeof(axis2_tcp_server_impl_t));
+    server_impl = (axis2_tcp_server_impl_t *)AXIS2_MALLOC(env->allocator,
+        sizeof(axis2_tcp_server_impl_t));
 
-    if (!server_impl)
+    if(!server_impl)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
@@ -112,7 +109,7 @@
 
     server_impl->tcp_server.ops = &tcp_transport_receiver_ops_var;
 
-    if (repo)
+    if(repo)
     {
 
         /**
@@ -122,10 +119,9 @@
          * may lead to double free
          */
         server_impl->conf_ctx_private = axis2_build_conf_ctx(env, repo);
-        if (!server_impl->conf_ctx_private)
+        if(!server_impl->conf_ctx_private)
         {
-            axis2_tcp_server_free((axis2_transport_receiver_t *) server_impl,
-                                  env);
+            axis2_tcp_server_free((axis2_transport_receiver_t *)server_impl, env);
             return NULL;
         }
         server_impl->conf_ctx = server_impl->conf_ctx_private;
@@ -141,14 +137,14 @@
     axis2_tcp_server_impl_t *server_impl = NULL;
     AXIS2_ENV_CHECK(env, void);
     server_impl = AXIS2_INTF_TO_IMPL(server);
-    if (server_impl->svr_thread)
+    if(server_impl->svr_thread)
     {
         axis2_tcp_svr_thread_destroy(server_impl->svr_thread, env);
         axis2_tcp_svr_thread_free(server_impl->svr_thread, env);
         server_impl->svr_thread = NULL;
     }
 
-    if (server_impl->conf_ctx_private)
+    if(server_impl->conf_ctx_private)
     {
         axis2_conf_ctx_free(server_impl->conf_ctx_private, env);
         server_impl->conf_ctx_private = NULL;
@@ -177,15 +173,13 @@
     server_impl = AXIS2_INTF_TO_IMPL(server);
 
     server_impl->conf_ctx = conf_ctx;
-    param =
-        (axutil_param_t *)
-        axutil_param_container_get_param(axis2_transport_in_desc_param_container
-                                         (in_desc, env), env, "port");
-    if (param)
+    param = (axutil_param_t *)axutil_param_container_get_param(
+        axis2_transport_in_desc_param_container(in_desc, env), env, "port");
+    if(param)
     {
         port_str = axutil_param_get_value(param, env);
     }
-    if (port_str)
+    if(port_str)
     {
         server_impl->port = atoi(port_str);
     }
@@ -203,15 +197,14 @@
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     server_impl = AXIS2_INTF_TO_IMPL(server);
-    server_impl->svr_thread = axis2_tcp_svr_thread_create(env,
-                                                          server_impl->port);
-    if (!server_impl->svr_thread)
+    server_impl->svr_thread = axis2_tcp_svr_thread_create(env, server_impl->port);
+    if(!server_impl->svr_thread)
     {
         return AXIS2_FAILURE;
     }
     worker = axis2_tcp_worker_create(env, server_impl->conf_ctx);
     axis2_tcp_worker_set_svr_port(worker, env, server_impl->port);
-    if (!worker)
+    if(!worker)
     {
         axis2_tcp_svr_thread_free(server_impl->svr_thread, env);
         return AXIS2_FAILURE;
@@ -230,10 +223,9 @@
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     AXIS2_LOG_INFO(env->log, "Terminating TCP server thread");
-    if (AXIS2_INTF_TO_IMPL(server)->svr_thread)
+    if(AXIS2_INTF_TO_IMPL(server)->svr_thread)
     {
-        axis2_tcp_svr_thread_destroy(AXIS2_INTF_TO_IMPL(server)->svr_thread,
-                                     env);
+        axis2_tcp_svr_thread_destroy(AXIS2_INTF_TO_IMPL(server)->svr_thread, env);
     }
     AXIS2_LOG_INFO(env->log, "Successfully terminated  TCP server" " thread");
     return AXIS2_SUCCESS;
@@ -263,10 +255,9 @@
 
     host_address = "127.0.0.1"; /* TODO : get from axis2.xml */
     svc_path = axutil_stracat(env, "/axis2/services/", svc_name);
-    url = axutil_url_create(env, "tcp", host_address,
-                            AXIS2_INTF_TO_IMPL(server)->port, svc_path);
+    url = axutil_url_create(env, "tcp", host_address, AXIS2_INTF_TO_IMPL(server)->port, svc_path);
     AXIS2_FREE(env->allocator, svc_path);
-    if (!url)
+    if(!url)
     {
         return NULL;
     }
@@ -283,7 +274,7 @@
     axis2_tcp_server_impl_t *server_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     server_impl = AXIS2_INTF_TO_IMPL(server);
-    if (!server_impl->svr_thread)
+    if(!server_impl->svr_thread)
     {
         return AXIS2_FALSE;
     }
@@ -299,7 +290,7 @@
     const axutil_env_t * env)
 {
     *inst = axis2_tcp_server_create(env, NULL, -1);
-    if (!(*inst))
+    if(!(*inst))
     {
         return AXIS2_FAILURE;
     }
@@ -312,7 +303,7 @@
     axis2_transport_receiver_t * inst,
     const axutil_env_t * env)
 {
-    if (inst)
+    if(inst)
     {
         axis2_transport_receiver_free(inst, env);
     }

Modified: webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_svr_thread.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_svr_thread.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_svr_thread.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_svr_thread.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -62,10 +61,10 @@
     axis2_tcp_svr_thread_t *svr_thread = NULL;
     AXIS2_ENV_CHECK(env, NULL);
 
-    svr_thread = (axis2_tcp_svr_thread_t *) AXIS2_MALLOC
-        (env->allocator, sizeof(axis2_tcp_svr_thread_t));
+    svr_thread = (axis2_tcp_svr_thread_t *)AXIS2_MALLOC(env->allocator,
+        sizeof(axis2_tcp_svr_thread_t));
 
-    if (!svr_thread)
+    if(!svr_thread)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
@@ -74,11 +73,11 @@
     svr_thread->worker = NULL;
     svr_thread->stopped = AXIS2_FALSE;
     svr_thread->port = port;
-    svr_thread->listen_socket = (int)axutil_network_handler_create_server_socket
-        (env, svr_thread->port);
-    if (-1 == svr_thread->listen_socket)
+    svr_thread->listen_socket = (int)axutil_network_handler_create_server_socket(env,
+        svr_thread->port);
+    if(-1 == svr_thread->listen_socket)
     {
-        axis2_tcp_svr_thread_free((axis2_tcp_svr_thread_t *) svr_thread, env);
+        axis2_tcp_svr_thread_free((axis2_tcp_svr_thread_t *)svr_thread, env);
         return NULL;
     }
 
@@ -92,12 +91,12 @@
 {
     AXIS2_ENV_CHECK(env, void);
 
-    if (svr_thread->worker)
+    if(svr_thread->worker)
     {
         axis2_tcp_worker_free(svr_thread->worker, env);
         svr_thread->worker = NULL;
     }
-    if (-1 != svr_thread->listen_socket)
+    if(-1 != svr_thread->listen_socket)
     {
         axutil_network_handler_close_socket(env, svr_thread->listen_socket);
         svr_thread->listen_socket = -1;
@@ -115,7 +114,7 @@
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    while (AXIS2_FALSE == svr_thread->stopped)
+    while(AXIS2_FALSE == svr_thread->stopped)
     {
         int socket = -1;
         axis2_tcp_svr_thd_args_t *arg_list = NULL;
@@ -123,40 +122,37 @@
         axutil_thread_t *worker_thread = NULL;
 #endif
 
-        socket = (int)axutil_network_handler_svr_socket_accept(env,
-                                                          svr_thread->
-                                                          listen_socket);
-        if (!svr_thread->worker)
+        socket = (int)axutil_network_handler_svr_socket_accept(env, svr_thread-> listen_socket);
+        if(!svr_thread->worker)
         {
             AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI, "Worker not ready yet."
-                              " Cannot serve the request");
+                " Cannot serve the request");
             axutil_network_handler_close_socket(env, socket);
             continue;
         }
-        arg_list = AXIS2_MALLOC(env->allocator,
-                                sizeof(axis2_tcp_svr_thd_args_t));
-        if (!arg_list)
+        arg_list = AXIS2_MALLOC(env->allocator, sizeof(axis2_tcp_svr_thd_args_t));
+        if(!arg_list)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                            "Memory allocation error in the svr thread loop");
+                "Memory allocation error in the svr thread loop");
             continue;
         }
-        arg_list->env = (axutil_env_t *) env;
+        arg_list->env = (axutil_env_t *)env;
         arg_list->socket = socket;
         arg_list->worker = svr_thread->worker;
 #ifdef AXIS2_SVR_MULTI_THREADED
         worker_thread = axutil_thread_pool_get_thread(env->thread_pool,
-                                                      axis2_svr_thread_worker_func,
-                                                      (void *) arg_list);
+            axis2_svr_thread_worker_func,
+            (void *) arg_list);
         if (!worker_thread)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Thread creation failed"
-                            "server thread loop");
+                "server thread loop");
             continue;
         }
         axutil_thread_pool_thread_detach(env->thread_pool, worker_thread);
 #else
-        axis2_svr_thread_worker_func(NULL, (void *) arg_list);
+        axis2_svr_thread_worker_func(NULL, (void *)arg_list);
 #endif
     }
     return AXIS2_SUCCESS;
@@ -169,14 +165,14 @@
 {
     AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
 
-    if (AXIS2_TRUE == svr_thread->stopped)
+    if(AXIS2_TRUE == svr_thread->stopped)
     {
         return AXIS2_SUCCESS;
     }
     svr_thread->stopped = AXIS2_TRUE;
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Terminating TCP server "
-                    "thread.");
-    if (svr_thread->listen_socket)
+        "thread.");
+    if(svr_thread->listen_socket)
     {
         axutil_network_handler_close_socket(env, svr_thread->listen_socket);
         svr_thread->listen_socket = -1;
@@ -220,8 +216,7 @@
     axutil_thread_t * thd,
     void *data)
 {
-    struct AXIS2_PLATFORM_TIMEB t1,
-     t2;
+    struct AXIS2_PLATFORM_TIMEB t1, t2;
     axis2_simple_tcp_svr_conn_t *svr_conn = NULL;
     axis2_char_t *request = NULL;
     int millisecs = 0;
@@ -239,8 +234,8 @@
 #endif
 #endif
 
-    arg_list = (axis2_tcp_svr_thd_args_t *) data;
-    if (!arg_list)
+    arg_list = (axis2_tcp_svr_thd_args_t *)data;
+    if(!arg_list)
     {
         return NULL;
     }
@@ -249,26 +244,24 @@
     thread_env = axutil_init_thread_env(env);
     socket = arg_list->socket;
     svr_conn = axis2_simple_tcp_svr_conn_create(thread_env, (int)socket);
-    axis2_simple_tcp_svr_conn_set_rcv_timeout(svr_conn, thread_env,
-                                              axis2_tcp_socket_read_timeout);
+    axis2_simple_tcp_svr_conn_set_rcv_timeout(svr_conn, thread_env, axis2_tcp_socket_read_timeout);
     request = axis2_simple_tcp_svr_conn_read_request(svr_conn, thread_env);
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "tcp request %s", request);
     tmp = arg_list->worker;
-    status = axis2_tcp_worker_process_request(tmp, thread_env, svr_conn,
-                                              request);
+    status = axis2_tcp_worker_process_request(tmp, thread_env, svr_conn, request);
     axis2_simple_tcp_svr_conn_free(svr_conn, thread_env);
 
     AXIS2_PLATFORM_GET_TIME_IN_MILLIS(&t2);
     millisecs = t2.millitm - t1.millitm;
     secs = difftime(t2.time, t1.time);
-    if (millisecs < 0)
+    if(millisecs < 0)
     {
         millisecs += 1000;
         secs--;
     }
     secs += millisecs / 1000.0;
 
-    if (status == AXIS2_SUCCESS)
+    if(status == AXIS2_SUCCESS)
     {
 #if defined(WIN32)
         AXIS2_LOG_INFO(thread_env->log, "Request served successfully");
@@ -280,17 +273,16 @@
     {
 #if defined(WIN32)
         AXIS2_LOG_WARNING(thread_env->log, AXIS2_LOG_SI,
-                          "Error occured in processing request ");
+            "Error occured in processing request ");
 #else
         AXIS2_LOG_WARNING(thread_env->log, AXIS2_LOG_SI,
-                          "Error occured in processing request (%.3f seconds)",
-                          secs);
+            "Error occured in processing request (%.3f seconds)", secs);
 #endif
     }
 
     AXIS2_FREE(thread_env->allocator, arg_list);
 
-    if (thread_env)
+    if(thread_env)
     {
         /* There is a persistant problem: Uncomment this after fix
          * the issue */

Modified: webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_worker.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_worker.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/tcp/receiver/tcp_worker.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -46,16 +45,15 @@
 {
     axis2_tcp_worker_t *tcp_worker = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    tcp_worker = (axis2_tcp_worker_t *)
-        AXIS2_MALLOC(env->allocator, sizeof(axis2_tcp_worker_t));
+    tcp_worker = (axis2_tcp_worker_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_tcp_worker_t));
 
-    if (!tcp_worker)
+    if(!tcp_worker)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
     tcp_worker->conf_ctx = conf_ctx;
-    tcp_worker->svr_port = 9090;    /* default - must set later */
+    tcp_worker->svr_port = 9090; /* default - must set later */
 
     return tcp_worker;
 }
@@ -97,58 +95,51 @@
     int write = -1;
     axutil_stream_t *out_stream = NULL;
 
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
-                    "start:axis2_tcp_worker_process_request");
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "start:axis2_tcp_worker_process_request");
 
     out_stream = axutil_stream_create_basic(env);
-    reader = axiom_xml_reader_create_for_memory(env, simple_request,
-                                                axutil_strlen(simple_request),
-                                                NULL,
-                                                AXIS2_XML_PARSER_TYPE_BUFFER);
-    if (!reader)
+    reader = axiom_xml_reader_create_for_memory(env, simple_request, axutil_strlen(simple_request),
+        NULL, AXIS2_XML_PARSER_TYPE_BUFFER);
+    if(!reader)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to create XML reader");
         return AXIS2_FAILURE;
     }
 
     builder = axiom_stax_builder_create(env, reader);
-    if (!builder)
+    if(!builder)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "Failed to create Stax builder");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to create Stax builder");
         return AXIS2_FAILURE;
     }
 
-    soap_builder = axiom_soap_builder_create(env, builder,
-                                             AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
+    soap_builder
+        = axiom_soap_builder_create(env, builder, AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
 
-    if (!soap_builder)
+    if(!soap_builder)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "Failed to create SOAP builder");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to create SOAP builder");
         return AXIS2_FAILURE;
     }
 
     conf_ctx = tcp_worker->conf_ctx;
 
-    if (!conf_ctx)
+    if(!conf_ctx)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "conf ctx not available");
         return AXIS2_FAILURE;
     }
 
-    out_desc =
-        axis2_conf_get_transport_out(axis2_conf_ctx_get_conf(conf_ctx, env),
-                                     env, AXIS2_TRANSPORT_ENUM_TCP);
-    if (!out_desc)
+    out_desc = axis2_conf_get_transport_out(axis2_conf_ctx_get_conf(conf_ctx, env), env,
+        AXIS2_TRANSPORT_ENUM_TCP);
+    if(!out_desc)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Transport out not set");
         return AXIS2_FAILURE;
     }
 
-    in_desc =
-        axis2_conf_get_transport_in(axis2_conf_ctx_get_conf(conf_ctx, env), env,
-                                    AXIS2_TRANSPORT_ENUM_TCP);
+    in_desc = axis2_conf_get_transport_in(axis2_conf_ctx_get_conf(conf_ctx, env), env,
+        AXIS2_TRANSPORT_ENUM_TCP);
 
     msg_ctx = axis2_msg_ctx_create(env, conf_ctx, in_desc, out_desc);
     axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
@@ -164,18 +155,17 @@
     buffer = out_stream->buffer;
     len = out_stream->len;
     buffer[len] = 0;
-    if (svr_stream && buffer)
+    if(svr_stream && buffer)
     {
         write = axutil_stream_write(svr_stream, env, buffer, len + 1);
-        if (write < 0)
+        if(write < 0)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "stream write failed");
             return AXIS2_FAILURE;
         }
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "stream wrote:%s", buffer);
     }
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
-                    "end:axis2_tcp_worker_process_request");
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "end:axis2_tcp_worker_process_request");
     return AXIS2_SUCCESS;
 }
 

Modified: webservices/axis2/trunk/c/src/core/transport/tcp/sender/tcp_transport_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/tcp/sender/tcp_transport_sender.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/tcp/sender/tcp_transport_sender.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/tcp/sender/tcp_transport_sender.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -49,23 +48,27 @@
      (transport_sender))
 
 /***************************** Function headers *******************************/
-axis2_status_t AXIS2_CALL axis2_tcp_transport_sender_invoke(
+axis2_status_t AXIS2_CALL
+axis2_tcp_transport_sender_invoke(
     axis2_transport_sender_t * transport_sender,
     const axutil_env_t * env,
     axis2_msg_ctx_t * msg_ctx);
 
-axis2_status_t AXIS2_CALL axis2_tcp_transport_sender_clean_up(
+axis2_status_t AXIS2_CALL
+axis2_tcp_transport_sender_clean_up(
     axis2_transport_sender_t * transport_sender,
     const axutil_env_t * env,
     axis2_msg_ctx_t * msg_ctx);
 
-axis2_status_t AXIS2_CALL axis2_tcp_transport_sender_init(
+axis2_status_t AXIS2_CALL
+axis2_tcp_transport_sender_init(
     axis2_transport_sender_t * transport_sender,
     const axutil_env_t * env,
     axis2_conf_ctx_t * conf_ctx,
     axis2_transport_out_desc_t * out_desc);
 
-axis2_status_t AXIS2_CALL axis2_tcp_transport_sender_write_message(
+axis2_status_t AXIS2_CALL
+axis2_tcp_transport_sender_write_message(
     axis2_transport_sender_t * transport_sender,
     const axutil_env_t * env,
     axis2_msg_ctx_t * msg_ctx,
@@ -78,11 +81,8 @@
     const axutil_env_t * env);
 
 static const axis2_transport_sender_ops_t tcp_transport_sender_ops_var = {
-    axis2_tcp_transport_sender_init,
-    axis2_tcp_transport_sender_invoke,
-    axis2_tcp_transport_sender_clean_up,
-    axis2_tcp_transport_sender_free
-};
+    axis2_tcp_transport_sender_init, axis2_tcp_transport_sender_invoke,
+    axis2_tcp_transport_sender_clean_up, axis2_tcp_transport_sender_free };
 
 axis2_transport_sender_t *AXIS2_CALL
 axis2_tcp_transport_sender_create(
@@ -91,16 +91,15 @@
     axis2_tcp_transport_sender_impl_t *transport_sender_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
 
-    transport_sender_impl = (axis2_tcp_transport_sender_impl_t *) AXIS2_MALLOC
-        (env->allocator, sizeof(axis2_tcp_transport_sender_impl_t));
+    transport_sender_impl = (axis2_tcp_transport_sender_impl_t *)AXIS2_MALLOC(env->allocator,
+        sizeof(axis2_tcp_transport_sender_impl_t));
 
-    if (!transport_sender_impl)
+    if(!transport_sender_impl)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
-    transport_sender_impl->connection_timeout =
-        AXIS2_TCP_DEFAULT_CONNECTION_TIMEOUT;
+    transport_sender_impl->connection_timeout = AXIS2_TCP_DEFAULT_CONNECTION_TIMEOUT;
     transport_sender_impl->so_timeout = AXIS2_TCP_DEFAULT_SO_TIMEOUT;
     transport_sender_impl->transport_sender.ops = &tcp_transport_sender_ops_var;
     return &(transport_sender_impl->transport_sender);
@@ -140,8 +139,7 @@
     axutil_hash_t *transport_attrs = NULL;
     axis2_bool_t write_xml_declaration = AXIS2_FALSE;
 
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                    "start:tcp transport sender invoke");
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "start:tcp transport sender invoke");
 
     op = axis2_msg_ctx_get_op(msg_ctx, env);
     mep_uri = axis2_op_get_msg_exchange_pattern(op, env);
@@ -150,87 +148,82 @@
 
     soap_envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
 
-    xml_writer = axiom_xml_writer_create_for_memory(env, NULL,
-                                                    AXIS2_TRUE, 0,
-                                                    AXIS2_XML_PARSER_TYPE_BUFFER);
-    if (!xml_writer)
+    xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
+        AXIS2_XML_PARSER_TYPE_BUFFER);
+    if(!xml_writer)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[tcp]Failed to create XML writer");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[tcp]Failed to create XML writer");
         return AXIS2_FAILURE;
     }
 
     om_output = axiom_output_create(env, xml_writer);
-    if (!om_output)
+    if(!om_output)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[tcp]Failed to create OM output");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[tcp]Failed to create OM output");
         axiom_xml_writer_free(xml_writer, env);
         xml_writer = NULL;
         return AXIS2_FAILURE;
     }
 
-    conf_ctx = axis2_msg_ctx_get_conf_ctx (msg_ctx, env);
-    if (conf_ctx)
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    if(conf_ctx)
     {
-        conf = axis2_conf_ctx_get_conf (conf_ctx, env);
+        conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     }
-    if (conf)
+    if(conf)
     {
-        trans_desc = axis2_conf_get_transport_out (conf,
-                                                   env, AXIS2_TRANSPORT_ENUM_TCP);
+        trans_desc = axis2_conf_get_transport_out(conf, env, AXIS2_TRANSPORT_ENUM_TCP);
     }
-    if (trans_desc)
+    if(trans_desc)
     {
-        write_xml_declaration_param =
-            axutil_param_container_get_param
-            (axis2_transport_out_desc_param_container (trans_desc, env), env,
-             AXIS2_XML_DECLARATION);
+        write_xml_declaration_param = axutil_param_container_get_param(
+            axis2_transport_out_desc_param_container(trans_desc, env), env, AXIS2_XML_DECLARATION);
     }
-    if (write_xml_declaration_param)
+    if(write_xml_declaration_param)
     {
-        transport_attrs = axutil_param_get_attributes (write_xml_declaration_param, env);
-        if (transport_attrs)
+        transport_attrs = axutil_param_get_attributes(write_xml_declaration_param, env);
+        if(transport_attrs)
         {
             axutil_generic_obj_t *obj = NULL;
             axiom_attribute_t *write_xml_declaration_attr = NULL;
             axis2_char_t *write_xml_declaration_attr_value = NULL;
 
-            obj = axutil_hash_get (transport_attrs, AXIS2_ADD_XML_DECLARATION,
-                           AXIS2_HASH_KEY_STRING);
-            if (obj)
+            obj
+                = axutil_hash_get(transport_attrs, AXIS2_ADD_XML_DECLARATION, AXIS2_HASH_KEY_STRING);
+            if(obj)
             {
-                write_xml_declaration_attr = (axiom_attribute_t *) axutil_generic_obj_get_value (obj,
-                                                                                         env);
+                write_xml_declaration_attr = (axiom_attribute_t *)axutil_generic_obj_get_value(obj,
+                    env);
             }
-            if (write_xml_declaration_attr)
+            if(write_xml_declaration_attr)
             {
-                write_xml_declaration_attr_value = axiom_attribute_get_value (write_xml_declaration_attr, env);
+                write_xml_declaration_attr_value = axiom_attribute_get_value(
+                    write_xml_declaration_attr, env);
             }
-            if (write_xml_declaration_attr_value && 0 == axutil_strcasecmp (write_xml_declaration_attr_value, AXIS2_VALUE_TRUE))
+            if(write_xml_declaration_attr_value && 0 == axutil_strcasecmp(
+                write_xml_declaration_attr_value, AXIS2_VALUE_TRUE))
             {
                 write_xml_declaration = AXIS2_TRUE;
             }
         }
     }
 
-    if (write_xml_declaration)
+    if(write_xml_declaration)
     {
-        axiom_output_write_xml_version_encoding (om_output, env);
+        axiom_output_write_xml_version_encoding(om_output, env);
     }
 
     axiom_soap_envelope_serialize(soap_envelope, env, om_output, AXIS2_FALSE);
 
-    buffer = (axis2_char_t *) axiom_xml_writer_get_xml(xml_writer, env);
-    if (!buffer)
+    buffer = (axis2_char_t *)axiom_xml_writer_get_xml(xml_writer, env);
+    if(!buffer)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[tcp]Failed to serialize the SOAP envelope");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[tcp]Failed to serialize the SOAP envelope");
         return AXIS2_FAILURE;
     }
     buffer_size = axiom_xml_writer_get_xml_size(xml_writer, env);
     buffer[buffer_size] = 0;
-    if (is_server)
+    if(is_server)
     {
         out_stream = axis2_msg_ctx_get_transport_out_stream(msg_ctx, env);
         axutil_stream_write(out_stream, env, buffer, buffer_size);
@@ -247,8 +240,7 @@
         int write = -1;
         int read = -1;
         axis2_char_t buff[1];
-        axis2_char_t *res_buffer = (axis2_char_t *) AXIS2_MALLOC(env->allocator,
-                                                                 RES_BUFF);
+        axis2_char_t *res_buffer = (axis2_char_t *)AXIS2_MALLOC(env->allocator, RES_BUFF);
         int res_size = 0;
         int size = 0;
         axiom_xml_reader_t *reader = NULL;
@@ -258,72 +250,68 @@
 
         to = axis2_msg_ctx_get_to(msg_ctx, env);
 
-        if (!to)
+        if(!to)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "To epr not presant");
             return AXIS2_FAILURE;
         }
 
         to_str = axis2_endpoint_ref_get_address(to, env);
-        if (!to_str)
+        if(!to_str)
         {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                            "unable to convert epr to string");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "unable to convert epr to string");
             return AXIS2_FAILURE;
         }
 
         to_url = axutil_url_parse_string(env, to_str);
 
-        if (!to_url)
+        if(!to_url)
         {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                            "unable to parser string to url");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "unable to parser string to url");
             return AXIS2_FAILURE;
         }
 
         host = axutil_url_get_host(to_url, env);
-        if (!host)
+        if(!host)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "retrieving host failed");
             return AXIS2_FAILURE;
         }
 
         port = axutil_url_get_port(to_url, env);
-        if (!port)
+        if(!port)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "retrieving port failed");
             return AXIS2_FAILURE;
         }
-        socket = (int)axutil_network_handler_open_socket(env, (char *) host, port);
-        if (!socket)
+        socket = (int)axutil_network_handler_open_socket(env, (char *)host, port);
+        if(!socket)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "socket creation failed");
             return AXIS2_FAILURE;
         }
 
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                        "open socket for host:%s port:%d", host, port);
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "open socket for host:%s port:%d", host, port);
 
         stream = axutil_stream_create_socket(env, socket);
-        if (!stream)
+        if(!stream)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "stream creation failed");
             return AXIS2_FAILURE;
         }
 
         write = axutil_stream_write(stream, env, buffer, buffer_size);
-        if (write < 0)
+        if(write < 0)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "stream write error");
             return AXIS2_FAILURE;
         }
-        AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "stream wrote soap msg: %s",
-                        buffer);
+        AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "stream wrote soap msg: %s", buffer);
         write = axutil_stream_write(stream, env, "\r\n\r\n", 4);
         size = RES_BUFF;
-        while ((read = axutil_stream_read(stream, env, &buff, 1)) > 0)
+        while((read = axutil_stream_read(stream, env, &buff, 1)) > 0)
         {
-            if (res_size >= size)
+            if(res_size >= size)
             {
                 axis2_char_t *tmp_buff = NULL;
                 size <<= 2;
@@ -342,40 +330,34 @@
 
         AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "%s", res_buffer);
 
-        reader =
-            axiom_xml_reader_create_for_memory(env, res_buffer, (res_size - 1),
-                                               NULL,
-                                               AXIS2_XML_PARSER_TYPE_BUFFER);
+        reader = axiom_xml_reader_create_for_memory(env, res_buffer, (res_size - 1), NULL,
+            AXIS2_XML_PARSER_TYPE_BUFFER);
 
-        if (!reader)
+        if(!reader)
         {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                            "Failed to create XML reader");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to create XML reader");
             return AXIS2_FAILURE;
         }
 
         builder = axiom_stax_builder_create(env, reader);
-        if (!builder)
+        if(!builder)
         {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                            "Failed to create Stax builder");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to create Stax builder");
             return AXIS2_FAILURE;
         }
 
         soap_builder = axiom_soap_builder_create(env, builder,
-                                                 AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
-        if (!soap_builder)
+            AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
+        if(!soap_builder)
         {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                            "Failed to create SOAP builder");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to create SOAP builder");
             return AXIS2_FAILURE;
         }
         soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
 
-        if (!soap_envelope)
+        if(!soap_envelope)
         {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                            "Failed to create SOAP envelope");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to create SOAP envelope");
             return AXIS2_FAILURE;
         }
 
@@ -414,31 +396,25 @@
     AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, out_desc, AXIS2_FAILURE);
 
-    temp_param =
-        axutil_param_container_get_param
-        (axis2_transport_out_desc_param_container(out_desc, env), env,
-         AXIS2_TCP_SO_TIMEOUT);
-    if (temp_param)
+    temp_param = axutil_param_container_get_param(axis2_transport_out_desc_param_container(
+        out_desc, env), env, AXIS2_TCP_SO_TIMEOUT);
+    if(temp_param)
     {
         temp = axutil_param_get_value(temp_param, env);
     }
-    if (temp)
+    if(temp)
     {
         AXIS2_INTF_TO_IMPL(transport_sender)->so_timeout = AXIS2_ATOI(temp);
     }
-    temp =
-        (axis2_char_t *)
-        axutil_param_container_get_param
-        (axis2_transport_out_desc_param_container(out_desc, env), env,
-         AXIS2_TCP_CONNECTION_TIMEOUT);
-    if (temp_param)
+    temp = (axis2_char_t *)axutil_param_container_get_param(
+        axis2_transport_out_desc_param_container(out_desc, env), env, AXIS2_TCP_CONNECTION_TIMEOUT);
+    if(temp_param)
     {
         temp = axutil_param_get_value(temp_param, env);
     }
-    if (temp)
+    if(temp)
     {
-        AXIS2_INTF_TO_IMPL(transport_sender)->connection_timeout =
-            AXIS2_ATOI(temp);
+        AXIS2_INTF_TO_IMPL(transport_sender)->connection_timeout = AXIS2_ATOI(temp);
     }
 
     return AXIS2_SUCCESS;
@@ -468,15 +444,15 @@
 
 AXIS2_EXPORT int
 #ifndef AXIS2_STATIC_DEPLOY
- axis2_get_instance(
+axis2_get_instance(
 #else
-axis2_tcp_transport_sender_get_instance(
+    axis2_tcp_transport_sender_get_instance(
 #endif
     struct axis2_transport_sender **inst,
     const axutil_env_t * env)
 {
     *inst = axis2_tcp_transport_sender_create(env);
-    if (!(*inst))
+    if(!(*inst))
     {
         return AXIS2_FAILURE;
     }
@@ -486,14 +462,14 @@
 
 AXIS2_EXPORT int
 #ifndef AXIS2_STATIC_DEPLOY
- axis2_remove_instance(
+axis2_remove_instance(
 #else
-axis2_tcp_transport_sender_remove_instance(
+    axis2_tcp_transport_sender_remove_instance(
 #endif
     axis2_transport_sender_t * inst,
     const axutil_env_t * env)
 {
-    if (inst)
+    if(inst)
     {
         AXIS2_TRANSPORT_SENDER_FREE(inst, env);
     }

Modified: webservices/axis2/trunk/c/src/core/transport/tcp/server/simple_tcp_server/tcp_server_main.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/tcp/server/simple_tcp_server/tcp_server_main.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/tcp/server/simple_tcp_server/tcp_server_main.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/tcp/server/simple_tcp_server/tcp_server_main.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -46,18 +45,22 @@
 int axis2_tcp_socket_read_timeout = 60000;
 
 /***************************** Function headers *******************************/
-axutil_env_t *init_syetem_env(
+axutil_env_t *
+init_syetem_env(
     axutil_allocator_t * allocator,
     const axis2_char_t * log_file);
 
-void system_exit(
+void
+system_exit(
     axutil_env_t * env,
     int status);
 
-void usage(
+void
+usage(
     axis2_char_t * prog_name);
 
-void sig_handler(
+void
+sig_handler(
     int signal);
 
 /***************************** End of function headers ************************/
@@ -73,8 +76,7 @@
      * threads
      */
     axiom_xml_reader_init();
-    return axutil_env_create_with_error_log_thread_pool(allocator, error, log,
-                                                        thread_pool);
+    return axutil_env_create_with_error_log_thread_pool(allocator, error, log, thread_pool);
 }
 
 void
@@ -83,11 +85,11 @@
     int status)
 {
     axutil_allocator_t *allocator = NULL;
-    if (server)
+    if(server)
     {
         axis2_transport_receiver_free(server, system_env);
     }
-    if (env)
+    if(env)
     {
         allocator = env->allocator;
         axutil_env_free(env);
@@ -112,50 +114,50 @@
     int port = AXIS2_TCP_SERVER_PORT;
     const axis2_char_t *repo_path = AXIS2_TCP_SERVER_REPO_PATH;
 
-    while ((c = AXIS2_GETOPT(argc, argv, ":p:r:ht:l:s:f:")) != -1)
+    while((c = AXIS2_GETOPT(argc, argv, ":p:r:ht:l:s:f:")) != -1)
     {
 
-        switch (c)
+        switch(c)
         {
-        case 'p':
-            port = AXIS2_ATOI(optarg);
-            break;
-        case 'r':
-            repo_path = optarg;
-            break;
-        case 't':
-            axis2_tcp_socket_read_timeout = AXIS2_ATOI(optarg) * 1000;
-            break;
-        case 'l':
-            log_level = AXIS2_ATOI(optarg);
-            if (log_level < AXIS2_LOG_LEVEL_CRITICAL)
-                log_level = AXIS2_LOG_LEVEL_CRITICAL;
-            if (log_level > AXIS2_LOG_LEVEL_TRACE)
-                log_level = AXIS2_LOG_LEVEL_TRACE;
-            break;
-        case 's':
-            log_file_size = 1024 * 1024 * AXIS2_ATOI(optarg);
-            break;
-        case 'f':
-            log_file = optarg;
-            break;
-        case 'h':
-            usage(argv[0]);
-            return 0;
-        case ':':
-            fprintf(stderr, "\nOption -%c requires an operand\n", optopt);
-            usage(argv[0]);
-            return -1;
-        case '?':
-            if (isprint(optopt))
-                fprintf(stderr, "\nUnknown option `-%c'.\n", optopt);
-            usage(argv[0]);
-            return -1;
+            case 'p':
+                port = AXIS2_ATOI(optarg);
+                break;
+            case 'r':
+                repo_path = optarg;
+                break;
+            case 't':
+                axis2_tcp_socket_read_timeout = AXIS2_ATOI(optarg) * 1000;
+                break;
+            case 'l':
+                log_level = AXIS2_ATOI(optarg);
+                if(log_level < AXIS2_LOG_LEVEL_CRITICAL)
+                    log_level = AXIS2_LOG_LEVEL_CRITICAL;
+                if(log_level > AXIS2_LOG_LEVEL_TRACE)
+                    log_level = AXIS2_LOG_LEVEL_TRACE;
+                break;
+            case 's':
+                log_file_size = 1024 * 1024 * AXIS2_ATOI(optarg);
+                break;
+            case 'f':
+                log_file = optarg;
+                break;
+            case 'h':
+                usage(argv[0]);
+                return 0;
+            case ':':
+                fprintf(stderr, "\nOption -%c requires an operand\n", optopt);
+                usage(argv[0]);
+                return -1;
+            case '?':
+                if(isprint(optopt))
+                    fprintf(stderr, "\nUnknown option `-%c'.\n", optopt);
+                usage(argv[0]);
+                return -1;
         }
     }
 
     allocator = axutil_allocator_init(NULL);
-    if (!allocator)
+    if(!allocator)
     {
         system_exit(NULL, -1);
     }
@@ -173,26 +175,21 @@
     AXIS2_LOG_INFO(env->log, "Starting Axis2 TCP server....");
     AXIS2_LOG_INFO(env->log, "Server port : %d", port);
     AXIS2_LOG_INFO(env->log, "Repo location : %s", repo_path);
-    AXIS2_LOG_INFO(env->log, "Read Timeout : %d ms",
-                   axis2_tcp_socket_read_timeout);
+    AXIS2_LOG_INFO(env->log, "Read Timeout : %d ms", axis2_tcp_socket_read_timeout);
 
     server = axis2_tcp_server_create(env, repo_path, port);
-    if (!server)
+    if(!server)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "Server creation failed: Error code:" " %d :: %s",
-                        env->error->error_number,
-                        AXIS2_ERROR_GET_MESSAGE(env->error));
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Server creation failed: Error code:" " %d :: %s",
+            env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error));
         system_exit(env, -1);
 
     }
     printf("Started Simple Axis2 TCP Server ...\n");
-    if (axis2_transport_receiver_start(server, env) == AXIS2_FAILURE)
+    if(axis2_transport_receiver_start(server, env) == AXIS2_FAILURE)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "Server start failed: Error code:" " %d :: %s",
-                        env->error->error_number,
-                        AXIS2_ERROR_GET_MESSAGE(env->error));
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Server start failed: Error code:" " %d :: %s",
+            env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error));
         system_exit(env, -1);
     }
     return 0;
@@ -212,24 +209,21 @@
     fprintf(stdout, " Options :\n");
     fprintf(stdout, "\t-p PORT \t port number to use, default port is %d\n", AXIS2_TCP_SERVER_PORT);
     fprintf(stdout, "\t-r REPO_PATH \t repository path, default is ../\n");
-    fprintf(stdout,
-            "\t-t TIMEOUT\t socket read timeout, default is 30 seconds\n");
-    fprintf(stdout,
-            "\t-l LOG_LEVEL\t log level, available log levels:"
-            "\n\t\t\t 0 - critical    1 - errors 2 - warnings"
-            "\n\t\t\t 3 - information 4 - debug  5- user 6 - trace"
-            "\n\t\t\t Default log level is 4(debug).\n");
+    fprintf(stdout, "\t-t TIMEOUT\t socket read timeout, default is 30 seconds\n");
+    fprintf(stdout, "\t-l LOG_LEVEL\t log level, available log levels:"
+        "\n\t\t\t 0 - critical    1 - errors 2 - warnings"
+        "\n\t\t\t 3 - information 4 - debug  5- user 6 - trace"
+        "\n\t\t\t Default log level is 4(debug).\n");
 #ifndef WIN32
-    fprintf(stdout,
-            "\t-f LOG_FILE\t log file, default is $AXIS2C_HOME/logs/axis2.log"
-            "\n\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
+    fprintf(stdout, "\t-f LOG_FILE\t log file, default is $AXIS2C_HOME/logs/axis2.log"
+        "\n\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
 #else
     fprintf(stdout,
-            "\t-f LOG_FILE\t log file, default is %%AXIS2C_HOME%%\\logs\\axis2.log"
-            "\n\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
+        "\t-f LOG_FILE\t log file, default is %%AXIS2C_HOME%%\\logs\\axis2.log"
+        "\n\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
 #endif
     fprintf(stdout,
-            "\t-s LOG_FILE_SIZE\t Maximum log file size in mega bytes, default maximum size is 1MB.\n");
+        "\t-s LOG_FILE_SIZE\t Maximum log file size in mega bytes, default maximum size is 1MB.\n");
     fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
 }
 
@@ -242,23 +236,23 @@
 sig_handler(
     int signal)
 {
-    switch (signal)
+    switch(signal)
     {
-    case SIGINT:
+        case SIGINT:
         {
             AXIS2_LOG_INFO(system_env->log, "Received signal SIGINT. Server "
-                           "shutting down");
+                "shutting down");
             axis2_tcp_server_stop(server, system_env);
             AXIS2_LOG_INFO(system_env->log, "Shutdown complete ...");
             system_exit(system_env, 0);
         }
-    case SIGPIPE:
+        case SIGPIPE:
         {
             AXIS2_LOG_INFO(system_env->log, "Received signal SIGPIPE.  Client "
-                           "request serve aborted");
+                "request serve aborted");
             return;
         }
-    case SIGSEGV:
+        case SIGSEGV:
         {
             fprintf(stderr, "Received deadly signal SIGSEGV. Terminating\n");
             _exit(-1);



Mime
View raw message