OSDN Git Service

Revert tcp_session.cpp
authortanuma <tanuma@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Thu, 6 May 2010 08:54:52 +0000 (08:54 +0000)
committertanuma <tanuma@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Thu, 6 May 2010 08:54:52 +0000 (08:54 +0000)
git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-ramiel-epoll-cond@10064 1ed66053-1c2d-0410-8867-f7571e6e31d3

l7vsd/src/tcp_session.cpp

index 153f5ff..b1476cf 100644 (file)
 #include "parameter.h"
 #include "utility.h"
 
-namespace l7vs {
-
-    //! constructor
-    //! @param[in/out]  vs is parent virtualservice object
-    //! @param[in/out]  session_io is session use io service object
-    //! @param[in]      set_option is session use set socket option info
-    //! @param[in]      listen_endpoint is virtualservice listen endpoint
-    //! @param[in]      ssl_mode is session use SSL flag
-    //! @param[in]      set_ssl_context is session use SSL context object
-    //! @param[in]      set_ssl_cache_flag is session use SSL session cache
-    //! @param[in]      set_ssl_handshake_time_out is session use SSL handshake timeout
-    //! @param[in]      set_access_logger is session use access logger
-    tcp_session::tcp_session(
-        virtualservice_tcp& vs,
-        boost::asio::io_service& session_io,
-        const tcp_socket_option_info set_option,
-        const boost::asio::ip::tcp::endpoint listen_endpoint,
-        const bool ssl_mode,
-        boost::asio::ssl::context& set_ssl_context,
-        const bool set_ssl_cache_flag,
-        const int set_ssl_handshake_time_out,
-        logger_implement_access* set_access_logger)
+
+namespace l7vs{
+
+    //! construcor
+    //! @param[in/out]    vs is parent virtualservice object
+    //! @param[in/out]    session_io is session use io service object
+    //! @param[in]        set_option is
+    //!                     session use set socket option info
+    //! @param[in]        listen_endpoint is
+    //!                     virtualservice listen endpoint
+    //! @param[in]        ssl_mode is session use SSL flag
+    //! @param[in]        set_ssl_context is
+    //!                     session use SSL context object
+    //! @param[in]        set_ssl_cache_flag is
+    //!                     session use SSL session cache
+    //! @param[in]        set_ssl_handshake_time_out is
+    //!                     session use SSL handshake timeout
+    //! @param[in]        set_access_logger is
+    //!                     session use access logger
+    tcp_session::tcp_session(virtualservice_tcp& vs,
+            boost::asio::io_service& session_io,
+            const tcp_socket_option_info set_option,
+            const boost::asio::ip::tcp::endpoint listen_endpoint,
+            const bool ssl_mode,
+            boost::asio::ssl::context& set_ssl_context,
+            const bool set_ssl_cache_flag,
+            const int set_ssl_handshake_time_out,
+            logger_implement_access* set_access_logger)
         :
         io(session_io),
         parent_service(vs),
         exit_flag(false),
-        upthread_status(UPTHREAD_SLEEP),
-        downthread_status(DOWNTHREAD_SLEEP),
-        realserver_connect_status(false),
+
+
+
+
+               upthread_status(UPTHREAD_SLEEP),
+               downthread_status(DOWNTHREAD_SLEEP),
+               realserver_connect_status(false),
         protocol_module(NULL),
         client_socket(session_io,set_option),
         upstream_buffer_size(-1),
@@ -73,8 +83,8 @@ namespace l7vs {
         ssl_handshake_timer_flag(false),
         ssl_handshake_time_out(set_ssl_handshake_time_out),
         ssl_handshake_time_out_flag(false),
-        socket_opt_info(set_option)
-    {
+        socket_opt_info(set_option){
+
         // sorryserver socket
         tcp_socket_ptr sorry_socket(new tcp_socket(session_io,socket_opt_info));
         sorryserver_socket.second = sorry_socket;
@@ -286,15 +296,13 @@ namespace l7vs {
         epoll_timeout = 50;
 
     }
-
     //! destructor
-    tcp_session::~tcp_session()
-    {
-        if ( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ) {
-            boost::format    formatter( "Thread ID[%d] FUNC IN ~tcp_session" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+    tcp_session::~tcp_session(){
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN ~tcp_session" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         // up_thread_module_event_map
         up_thread_module_event_map.clear();
@@ -310,7 +318,7 @@ namespace l7vs {
         virtual_service_message_down_thread_function_map.clear();
         // up_thread_message_que
         tcp_thread_message*    msg;
-        while (1) {
+        while(1){
             msg = up_thread_message_que.pop();
             if( msg )
                 delete msg;
@@ -318,7 +326,7 @@ namespace l7vs {
                 break;
         }
         // down_thread_message_que
-        while (1) {
+        while(1){
             msg = down_thread_message_que.pop();
             if( msg )
                 delete msg;
@@ -330,10 +338,8 @@ namespace l7vs {
         close( down_client_epollfd );
         close( down_realserver_epollfd );
     }
-
     //! initialize
-    session_result_message tcp_session::initialize()
-    {
+    session_result_message tcp_session::initialize(){
         session_result_message msg;
         msg.flag = false;
         msg.message = "";
@@ -342,19 +348,19 @@ namespace l7vs {
         down_thread_id = boost::thread::id();
         ssl_handshake_timer_flag = false;
         ssl_handshake_time_out_flag = false;
-        upthread_status = UPTHREAD_SLEEP;
-        downthread_status = DOWNTHREAD_SLEEP;
-        realserver_connect_status = false;
+               upthread_status = UPTHREAD_SLEEP;
+               downthread_status = DOWNTHREAD_SLEEP;
+               realserver_connect_status = false;
         protocol_module = NULL;
         tcp_thread_message* tmp_msg;
-        while (1) {
+        while(1){
             tmp_msg = up_thread_message_que.pop();
             if( tmp_msg )
                 delete tmp_msg;
             else
                 break;
         }
-        while (1) {
+        while(1){
             tmp_msg = down_thread_message_que.pop();
             if( tmp_msg )
                 delete tmp_msg;
@@ -368,7 +374,7 @@ namespace l7vs {
         int                    int_val;
 
         int_val    = param.get_int( PARAM_COMP_SESSION, PARAM_UP_BUFFER_SIZE, vs_err );
-        if ( likely(!vs_err) && (0 < int_val) ) {
+        if((likely( !vs_err )) && (0 < int_val)){
             upstream_buffer_size    = int_val;
         }
 
@@ -467,11 +473,11 @@ namespace l7vs {
         down_realserver_epollfd_registered = false;
         down_sorryserver_epollfd_registered = false;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT ~tcp_session" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT ~tcp_session" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         return msg;
     }
@@ -481,11 +487,11 @@ namespace l7vs {
     //! @return         true is clear OK.
     //! @return         false is not clear
     bool tcp_session::ssl_clear_keep_cache(SSL *clear_ssl){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN ssl_clear_keep_cache" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN ssl_clear_keep_cache" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         if (clear_ssl->method == NULL) {
             //----Debug log----------------------------------------------------------------------
@@ -542,7 +548,7 @@ namespace l7vs {
         clear_ssl->client_version = clear_ssl->version;
         clear_ssl->rwstate = SSL_NOTHING;
         clear_ssl->rstate = SSL_ST_READ_HEADER;
-        clear_ssl->state = SSL_ST_BEFORE | clear_ssl->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT;
+        clear_ssl->state = SSL_ST_BEFORE | ( ( clear_ssl->server ) ? SSL_ST_ACCEPT : SSL_ST_CONNECT);
 
         // init_buf free
         if ( clear_ssl->init_buf != NULL ) {
@@ -610,11 +616,11 @@ namespace l7vs {
             clear_ssl->method->ssl_clear( clear_ssl );
         }
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT ssl_clear_keep_cache" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT ssl_clear_keep_cache" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         return (true);
     }
@@ -622,41 +628,41 @@ namespace l7vs {
     //! get reference client side socket
     //! @return            reference client side socket
     boost::asio::ip::tcp::socket& tcp_session::get_client_socket(){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN/OUT get_client_socket" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN/OUT get_client_socket" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         return client_socket.get_socket();
     }
     //! get reference client side ssl socket
     //! @return            reference client side ssl socket
     ssl_socket& tcp_session::get_client_ssl_socket(){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN/OUT get_client_ssl_socket" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN/OUT get_client_ssl_socket" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         return client_ssl_socket.get_socket();
     }
     //! message from parent virtualservice
     //! @param[in]        message is tcp virtualservice message type
     void tcp_session::set_virtual_service_message(const TCP_VIRTUAL_SERVICE_MESSAGE_TAG  message){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN set_virtual_service_message" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN set_virtual_service_message" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         switch(message){
             case SESSION_PAUSE_ON:
                 {
-                    boost::mutex::scoped_lock    lock( upthread_status_mutex );
-                        upthread_status = UPTHREAD_LOCK;
-                    boost::mutex::scoped_lock    lock2( downthread_status_mutex );
-                        downthread_status = DOWNTHREAD_LOCK;
+                                       boost::mutex::scoped_lock       lock( upthread_status_mutex );
+                                               upthread_status = UPTHREAD_LOCK;
+                                       boost::mutex::scoped_lock       lock2( downthread_status_mutex );
+                                               downthread_status = DOWNTHREAD_LOCK;
                 }
                 //----Debug log----------------------------------------------------------------------
                 if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
@@ -670,12 +676,12 @@ namespace l7vs {
                 return;
             case SESSION_PAUSE_OFF:
                 {
-                    boost::mutex::scoped_lock( upthread_status_mutex );
-                    if( upthread_status == UPTHREAD_LOCK )
-                        upthread_status_cond.notify_one();
-                    boost::mutex::scoped_lock( downthread_status_mutex );
-                    if( downthread_status == DOWNTHREAD_LOCK )
-                        downthread_status_cond.notify_one();
+                                       boost::mutex::scoped_lock( upthread_status_mutex );
+                                       if( upthread_status == UPTHREAD_LOCK )
+                                               upthread_status_cond.notify_one();
+                                       boost::mutex::scoped_lock( downthread_status_mutex );
+                                       if( downthread_status == DOWNTHREAD_LOCK )
+                                               downthread_status_cond.notify_one();
                 }
                 //----Debug log----------------------------------------------------------------------
                 if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
@@ -756,74 +762,72 @@ namespace l7vs {
         std::map< TCP_VIRTUAL_SERVICE_MESSAGE_TAG, tcp_session_func>::iterator up_func;
         up_func = virtual_service_message_up_thread_function_map.find(message);
 
-        up_msg->message = up_func->second;
-        while(!up_thread_message_que.push(up_msg)){}
+               up_msg->message = up_func->second;
+               while(!up_thread_message_que.push(up_msg)){}
 
         tcp_thread_message*    down_msg    = new tcp_thread_message;
         std::map< TCP_VIRTUAL_SERVICE_MESSAGE_TAG, tcp_session_func>::iterator down_func;
         down_func = virtual_service_message_down_thread_function_map.find(message);
-        down_msg->message = down_func->second;
-        while(!down_thread_message_que.push(down_msg)){}
-
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT set_virtual_service_message" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               down_msg->message = down_func->second;
+               while(!down_thread_message_que.push(down_msg)){}
+
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT set_virtual_service_message" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up stream thread main function
     void tcp_session::up_thread_run(){
-        boost::system::error_code ec;
-
         //----Debug log----------------------------------------------------------------------
-        if( unlikely( LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format formatter("Thread ID[%d] FUNC IN up_thread_run");
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug(LOG_CAT_L7VSD_SESSION, 17, formatter.str(), __FILE__, __LINE__);
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_run" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 17, formatter.str(), __FILE__, __LINE__ );
+               }
         //----Debug log----------------------------------------------------------------------
-
         up_thread_id = boost::this_thread::get_id();
-        {
-            boost::mutex::scoped_lock(upthread_status_mutex);
-            boost::mutex::scoped_lock(realserver_connect_mutex);
-            upthread_status = UPTHREAD_ALIVE;
-            realserver_connect_status = false;
-        }
-
+               {
+                       boost::mutex::scoped_lock( upthread_status_mutex );
+                       boost::mutex::scoped_lock( realserver_connect_mutex );
+                       upthread_status = UPTHREAD_ALIVE;
+                       realserver_connect_status = false;
+               }
         //----Debug log----------------------------------------------------------------------
-        if ( unlikely( LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+        if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
             std::stringstream buf;
-            buf << "Thread ID[" << boost::this_thread::get_id() << "] ";
-            buf << "up thread down thread alive wait start";
-            Logger::putLogDebug(LOG_CAT_L7VSD_SESSION, 18, buf.str(), __FILE__, __LINE__);
+            buf << "Thread ID[";
+            buf << boost::this_thread::get_id();
+            buf << "] up thread down thread alive wait start";
+            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 18, buf.str(), __FILE__, __LINE__ );
         }
         //----Debug log----------------------------------------------------------------------
-
-        {
-            boost::mutex::scoped_lock lock(downthread_status_mutex);
-            if(downthread_status < DOWNTHREAD_ALIVE)
-                downthread_status_cond.wait(lock);
-        }
-
+               {
+                       boost::mutex::scoped_lock       lock( downthread_status_mutex );
+                       if( downthread_status < DOWNTHREAD_ALIVE )
+                               downthread_status_cond.wait( lock );
+               }
         //----Debug log----------------------------------------------------------------------
-        if ( unlikely( LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+        if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
             std::stringstream buf;
-            buf << "Thread ID[" << boost::this_thread::get_id() << "] ";
-            buf << "up thread down thread alive wait end";
-            Logger::putLogDebug(LOG_CAT_L7VSD_SESSION, 19, buf.str(), __FILE__, __LINE__);
+            buf << "Thread ID[";
+            buf << boost::this_thread::get_id();
+            buf << "] up thread down thread alive wait end";
+            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 19, buf.str(), __FILE__, __LINE__ );
         }
         //----Debug log----------------------------------------------------------------------
+        if(likely( !exit_flag )){
+            bool bres;
+                       (!ssl_flag)     ?       bres = client_socket.get_socket().lowest_layer().is_open()
+                                               :       bres = client_ssl_socket.get_socket().lowest_layer().is_open();
 
-        if ( likely(!exit_flag) ) {
-            bool bres = !ssl_flag ? client_socket.get_socket().lowest_layer().is_open()
-                                  : client_ssl_socket.get_socket().lowest_layer().is_open();
-            if ( unlikely(!bres) ) {
+            if(unlikely( !bres )){
                 //client socket not open Error!
                 std::stringstream buf;
-                buf << "Thread ID[" << boost::this_thread::get_id() << "] ";
-                buf << "client socket not open!";
-                Logger::putLogError(LOG_CAT_L7VSD_SESSION, 9, buf.str(), __FILE__, __LINE__);
+                buf << "Thread ID[";
+                buf << boost::this_thread::get_id();
+                buf << "] client socket not open!";
+                Logger::putLogError( LOG_CAT_L7VSD_SESSION, 9, buf.str(), __FILE__, __LINE__ );
                 {
                     rw_scoped_lock scoped_lock(exit_flag_update_mutex);
                     exit_flag = true;
@@ -831,59 +835,60 @@ namespace l7vs {
             }
         }
         
-        if (!ssl_flag)
-            client_socket.accept();
-        else
-            client_ssl_socket.accept();
+        boost::system::error_code ec;
+               (!ssl_flag)     ?       client_socket.accept()
+                                       :       client_ssl_socket.accept();
         
-        if ( likely(!exit_flag) ) {
-            (!ssl_flag) ? client_endpoint = client_socket.get_socket().lowest_layer().remote_endpoint(ec)
-                        : client_endpoint = client_ssl_socket.get_socket().lowest_layer().remote_endpoint(ec);
+        if(likely( !exit_flag )){
+                       (!ssl_flag)     ?       client_endpoint = client_socket.get_socket().lowest_layer().remote_endpoint(ec)
+                                               :       client_endpoint = client_ssl_socket.get_socket().lowest_layer().remote_endpoint(ec);
 
-            if ( unlikely(ec) ) {
+            if(unlikely( ec )){
                 //client endpoint get Error!
                 std::stringstream buf;
-                buf << "Thread ID[" << boost::this_thread::get_id() << "] ";
-                buf << "client endpoint get false : ";
+                buf << "Thread ID[";
+                buf << boost::this_thread::get_id();
+                buf << "] client endpoint get false : ";
                 buf << ec.message();
-                Logger::putLogError(LOG_CAT_L7VSD_SESSION, 10, buf.str(), __FILE__, __LINE__);
+                Logger::putLogError( LOG_CAT_L7VSD_SESSION, 10, buf.str(), __FILE__, __LINE__ );
                 {
                     rw_scoped_lock scoped_lock(exit_flag_update_mutex);
                     exit_flag = true;
                 }
             }
         }
-        if ( likely(!exit_flag) ) {
-            bool bres = !ssl_flag ? client_socket.set_non_blocking_mode(ec)
-                                  : client_ssl_socket.set_non_blocking_mode(ec);
-            if ( unlikely(!bres) ) {
+        if(likely( !exit_flag )){
+            bool bres;
+                       (!ssl_flag)     ?       bres = client_socket.set_non_blocking_mode(ec)
+                                               :       bres = client_ssl_socket.set_non_blocking_mode(ec);
+
+            if(unlikely( !bres )){
                 // socket set nonblocking mode error
                 std::stringstream buf;
-                buf << "Thread ID[" << boost::this_thread::get_id() << "] ";
-                buf << "set non blocking socket error :";
+                buf << "Thread ID[";
+                buf << boost::this_thread::get_id();
+                buf << "] set non blocking socket error :";
                 buf << ec.message();
-                Logger::putLogError(LOG_CAT_L7VSD_SESSION, 11, buf.str(), __FILE__, __LINE__);
+                Logger::putLogError( LOG_CAT_L7VSD_SESSION, 11, buf.str(), __FILE__, __LINE__ );
                 {
                     rw_scoped_lock scoped_lock(exit_flag_update_mutex);
                     exit_flag = true;
                 }
             }
         }
-        if ( likely(!exit_flag) ) {
+
+        if(likely( !exit_flag )){
             //set client_socket options(recieve buffer size)
             if (upstream_buffer_size > 0) {
                 boost::asio::socket_base::receive_buffer_size opt1(upstream_buffer_size);
-
-                if (!ssl_flag)
-                    client_socket.get_socket().lowest_layer().set_option(opt1, ec)
-                else
-                    client_ssl_socket.get_socket().lowest_layer().set_option(opt1, ec);
-
-                if ( unlikely(ec) ) {
+                               (!ssl_flag)     ?       client_socket.get_socket().lowest_layer().set_option(opt1, ec)
+                                                       :       client_ssl_socket.get_socket().lowest_layer().set_option(opt1, ec);
+                if(unlikely( ec )){
                     //client socket Error!
                     std::stringstream buf;
-                    buf << "Thread ID[" << boost::this_thread::get_id() << "] ";
-                    buf << "client socket recieve buffer size error : ";
+                    buf << "Thread ID[";
+                    buf << boost::this_thread::get_id();
+                    buf << "] client socket recieve buffer size error : ";
                     buf << ec.message();
                     Logger::putLogError( LOG_CAT_L7VSD_SESSION, 12, buf.str(), __FILE__, __LINE__ );
                     {
@@ -894,17 +899,15 @@ namespace l7vs {
             }
         }
 
-        if ( likely(!exit_flag) ) {
+        if(likely( !exit_flag )){
             //set client_socket options(send buffer size)
             if (downstream_buffer_size > 0) {
                 boost::asio::socket_base::send_buffer_size opt2(downstream_buffer_size);
 
-                if (!ssl_flag)
-                    client_socket.get_socket().lowest_layer().set_option(opt2, ec)
-                else
-                    client_ssl_socket.get_socket().lowest_layer().set_option(opt2, ec);
+                               (!ssl_flag)     ?       client_socket.get_socket().lowest_layer().set_option(opt2, ec)
+                                                       :       client_ssl_socket.get_socket().lowest_layer().set_option(opt2, ec);
 
-                if ( unlikely(ec) ) {
+                if(unlikely( ec )){
                     //client socket Error!
                     std::stringstream buf;
                     buf << "Thread ID[";
@@ -923,19 +926,19 @@ namespace l7vs {
         boost::asio::ip::udp::endpoint dumy_end;
         protocol_module_base::EVENT_TAG module_event;
         std::map< protocol_module_base::EVENT_TAG , UP_THREAD_FUNC_TYPE_TAG >::iterator func_type;
-        up_thread_function_pair func;
+        up_thread_function_pair    func;
 
         if(likely(!exit_flag)){
             module_event = protocol_module->handle_session_initialize(up_thread_id,down_thread_id,client_endpoint,dumy_end);
             func_type = up_thread_module_event_map.find(module_event);
-            func = up_thread_function_array[func_type->second];
-            up_thread_next_call_function = func;
-        }
-        {
-            boost::mutex::scoped_lock lock( upthread_status_mutex );
-            upthread_status = UPTHREAD_ACTIVE;
-            upthread_status_cond.notify_one();
-        }
+                       func = up_thread_function_array[func_type->second];
+                       up_thread_next_call_function = func;
+        }
+               {
+                       boost::mutex::scoped_lock       lock( upthread_status_mutex );
+                       upthread_status = UPTHREAD_ACTIVE;
+                       upthread_status_cond.notify_one();
+               }
         //----Debug log----------------------------------------------------------------------
         if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
             std::stringstream buf;
@@ -946,13 +949,13 @@ namespace l7vs {
         }
         //----Debug log----------------------------------------------------------------------
         while(!exit_flag){
-            {
-                boost::mutex::scoped_lock lock( upthread_status_mutex );
-                if( upthread_status == UPTHREAD_LOCK )
-                    upthread_status_cond.wait( lock );
-                upthread_status = UPTHREAD_ACTIVE;
-                upthread_status_cond.notify_one();
-            }
+                       {
+                               boost::mutex::scoped_lock lock( upthread_status_mutex );
+                               if( upthread_status == UPTHREAD_LOCK )
+                                       upthread_status_cond.wait( lock );
+                               upthread_status = UPTHREAD_ACTIVE;
+                               upthread_status_cond.notify_one();
+                       }
 
             tcp_thread_message*    msg    = up_thread_message_que.pop();
             if(unlikely( msg )){
@@ -979,9 +982,9 @@ namespace l7vs {
         //----Debug log----------------------------------------------------------------------
         
         up_thread_all_socket_close();
-        upthread_status_mutex.lock();
-        upthread_status = UPTHREAD_ALIVE;
-        upthread_status_mutex.unlock();
+               upthread_status_mutex.lock();
+               upthread_status = UPTHREAD_ALIVE;
+               upthread_status_mutex.unlock();
 
         //----Debug log----------------------------------------------------------------------
         if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
@@ -992,18 +995,18 @@ namespace l7vs {
             Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 22, buf.str(), __FILE__, __LINE__ );
         }
         //----Debug log----------------------------------------------------------------------
-        {
-            boost::mutex::scoped_lock    lock( downthread_status_mutex );
-            if( downthread_status != DOWNTHREAD_SLEEP ){
-                if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
-                    boost::format formatter( "Thread ID[%s] down thread finalize wait" );
-                    formatter % boost::this_thread::get_id();
-                    Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-                }
-                to_time( LOCKTIMEOUT, xt );
-                downthread_status_cond.wait( lock );
-            }
-        }
+               {
+                       boost::mutex::scoped_lock       lock( downthread_status_mutex );
+                       if( downthread_status != DOWNTHREAD_SLEEP ){
+                               if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
+                                       boost::format formatter( "Thread ID[%s] down thread finalize wait" );
+                                       formatter % boost::this_thread::get_id();
+                                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+                               }
+                               to_time( LOCKTIMEOUT, xt );
+                               downthread_status_cond.wait( lock );
+                       }
+               }
 
         //----Debug log----------------------------------------------------------------------
         if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
@@ -1025,34 +1028,34 @@ namespace l7vs {
             Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 24, buf.str(), __FILE__, __LINE__ );
         }
         //----Debug log----------------------------------------------------------------------
-        upthread_status_mutex.lock();
-        upthread_status = UPTHREAD_SLEEP;
-        upthread_status_mutex.unlock();
+               upthread_status_mutex.lock();
+               upthread_status = UPTHREAD_SLEEP;
+               upthread_status_mutex.unlock();
         parent_service.release_session(this);
 
         //----Debug log----------------------------------------------------------------------
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_run" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 18, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_run" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 18, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     
     //! down stream thread main function
     void tcp_session::down_thread_run(){
         //----Debug log----------------------------------------------------------------------
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_run" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 27, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_run" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 27, formatter.str(), __FILE__, __LINE__ );
+               }
         //----Debug log----------------------------------------------------------------------
         down_thread_id = boost::this_thread::get_id(); 
-        {
-            boost::mutex::scoped_lock    lock( downthread_status_mutex );
-            downthread_status = DOWNTHREAD_ALIVE;
-            downthread_status_cond.notify_one();
-        }
+               {
+                       boost::mutex::scoped_lock       lock( downthread_status_mutex );
+                       downthread_status = DOWNTHREAD_ALIVE;
+                       downthread_status_cond.notify_one();
+               }
         //----Debug log----------------------------------------------------------------------
         if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
             std::stringstream buf;
@@ -1062,13 +1065,13 @@ namespace l7vs {
             Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 28, buf.str(), __FILE__, __LINE__ );
         }
         //----Debug log----------------------------------------------------------------------
-        {
-            boost::mutex::scoped_lock    lock( upthread_status_mutex );
-            if( upthread_status != UPTHREAD_ACTIVE ){
-                to_time( LOCKTIMEOUT, xt );
-                upthread_status_cond.timed_wait( upthread_status_mutex, xt );
-            }
-        }
+               {
+                       boost::mutex::scoped_lock       lock( upthread_status_mutex );
+                       if( upthread_status != UPTHREAD_ACTIVE ){
+                               to_time( LOCKTIMEOUT, xt );
+                               upthread_status_cond.timed_wait( upthread_status_mutex, xt );
+                       }
+               }
 
         //----Debug log----------------------------------------------------------------------
         if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
@@ -1079,11 +1082,11 @@ namespace l7vs {
             Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 29, buf.str(), __FILE__, __LINE__ );
         }
         //----Debug log----------------------------------------------------------------------
-        {
-            boost::mutex::scoped_lock    lock( downthread_status_mutex );
-            downthread_status = DOWNTHREAD_ACTIVE;
-            downthread_status_cond.notify_one();
-        }
+               {
+                       boost::mutex::scoped_lock       lock( downthread_status_mutex );
+                       downthread_status = DOWNTHREAD_ACTIVE;
+                       downthread_status_cond.notify_one();
+               }
 
         down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_REALSERVER_RECEIVE];
 
@@ -1098,12 +1101,12 @@ namespace l7vs {
         //----Debug log----------------------------------------------------------------------
 
         while(!exit_flag){
-            if( downthread_status == DOWNTHREAD_LOCK ){
-                    boost::mutex::scoped_lock    lock( downthread_status_mutex );
-                    to_time( LOCKTIMEOUT, xt );
-                    downthread_status_cond.timed_wait( lock, xt );
-                    downthread_status = DOWNTHREAD_ACTIVE;
-            }
+                       if( downthread_status == DOWNTHREAD_LOCK ){
+                                       boost::mutex::scoped_lock       lock( downthread_status_mutex );
+                                       to_time( LOCKTIMEOUT, xt );
+                                       downthread_status_cond.timed_wait( lock, xt );
+                                       downthread_status = DOWNTHREAD_ACTIVE;
+                       }
             while(unlikely( !down_thread_connect_socket_list.empty() )){
                 std::pair<endpoint,tcp_socket_ptr > push_rs_socket = down_thread_connect_socket_list.get_socket();
                 down_thread_receive_realserver_socket_list.push_back(push_rs_socket);
@@ -1136,21 +1139,21 @@ namespace l7vs {
         }
         //----Debug log----------------------------------------------------------------------
         down_thread_all_socket_close();
-        {
-            boost::mutex::scoped_lock    lock( downthread_status_mutex );
-            downthread_status = DOWNTHREAD_ALIVE;
-            downthread_status_cond.notify_one(); 
-        }        //----Debug log----------------------------------------------------------------------
+               {
+                       boost::mutex::scoped_lock       lock( downthread_status_mutex );
+                       downthread_status = DOWNTHREAD_ALIVE;
+                       downthread_status_cond.notify_one(); 
+               }        //----Debug log----------------------------------------------------------------------
         //----Debug log----------------------------------------------------------------------
-        boost::mutex::scoped_lock    lock( downthread_status_mutex );
-        downthread_status = DOWNTHREAD_SLEEP;
-        upthread_status_cond.notify_one();
-
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_run" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 32, formatter.str(), __FILE__, __LINE__ );
-        }
+               boost::mutex::scoped_lock       lock( downthread_status_mutex );
+               downthread_status = DOWNTHREAD_SLEEP;
+               upthread_status_cond.notify_one();
+
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_run" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 32, formatter.str(), __FILE__, __LINE__ );
+               }
     }
 
     //! endpoint data to string infomation
@@ -1158,11 +1161,11 @@ namespace l7vs {
     std::string tcp_session::endpoint_to_string(
                 const boost::asio::ip::tcp::endpoint& target_endpoint){
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN endpoint_to_string" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN endpoint_to_string" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
 
         std::stringstream ret;
@@ -1172,11 +1175,11 @@ namespace l7vs {
             ret << target_endpoint.address().to_string() << ":" << target_endpoint.port();
         }
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT endpoint_to_string" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT endpoint_to_string" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         return ret.str();
     }
@@ -1184,11 +1187,11 @@ namespace l7vs {
     //! up thread accept client side
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_client_accept(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_client_accept" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_client_accept" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
 
         UP_THREAD_FUNC_TYPE_TAG func_tag;
@@ -1266,21 +1269,21 @@ namespace l7vs {
         }
         up_thread_next_call_function = up_thread_function_array[func_tag];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_client_accept : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_client_accept : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
 
     //! up thread raise module event of handle_accept and do handshake
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_client_accept_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_client_accept_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_client_accept_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
         
         protocol_module_base::EVENT_TAG module_event;
         module_event = protocol_module->handle_accept(up_thread_id);
@@ -1289,11 +1292,11 @@ namespace l7vs {
         up_thread_function_pair    func    = up_thread_function_array[func_type->second];
         up_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_client_accept_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_client_accept_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
 
     //! handshake timer handler
@@ -1301,11 +1304,11 @@ namespace l7vs {
     void tcp_session::handle_ssl_handshake_timer(
         const boost::system::error_code& error) {
         //----Debug log--------------------------------------------------------
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN handle_ssl_handshake_timer" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 72, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN handle_ssl_handshake_timer" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 72, formatter.str(), __FILE__, __LINE__ );
+               }
 
         if(!error){
 
@@ -1338,21 +1341,21 @@ namespace l7vs {
         }
 
         //----Debug log--------------------------------------------------------
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT handle_ssl_handshake_timer" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 73, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT handle_ssl_handshake_timer" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 73, formatter.str(), __FILE__, __LINE__ );
+               }
     }
 
     //! up thread receive client side and raise module event of handle_client_recv
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_client_receive(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_client_receive" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_client_receive" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
 
         if(unlikely(0 < parent_service.get_wait_upstream())){
@@ -1374,10 +1377,11 @@ namespace l7vs {
         UP_THREAD_FUNC_TYPE_TAG func_tag;
 
         struct epoll_event event;
-        event.data.fd = !ssl_flag ? client_socket.get_socket().native()
-                                  : client_ssl_socket.get_socket().lowest_layer().native();
+        ( !ssl_flag )  ?       event.data.fd = client_socket.get_socket().native()
+                                               :       event.data.fd = client_ssl_socket.get_socket().lowest_layer().native();
 
-        // epoll wailt codes
+               //
+               // epoll wailt codes
         if (is_epoll_edge_trigger) {
             event.events = EPOLLET | EPOLLIN | EPOLLHUP;
         } else {
@@ -1397,120 +1401,116 @@ namespace l7vs {
             add_flag = true;
         }
 
-        if (is_epoll_edge_trigger && (!add_flag)) {
-            if (epoll_ctl( up_client_epollfd, EPOLL_CTL_MOD, event.data.fd, &event ) < 0) {
-                std::stringstream buf;
-                buf << "up_thread_client_receive : epoll_ctl EPOLL_CTL_MOD error : ";
-                buf << strerror(errno);
-                Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, buf.str(), __FILE__, __LINE__ );
-                up_thread_next_call_function = up_thread_function_array[UP_FUNC_CLIENT_DISCONNECT];
-                return;
-            }
-        }
-        int ret_fds = epoll_wait( up_client_epollfd, up_client_events, EVENT_NUM, epoll_timeout );
-        if (ret_fds <= 0) {
-            if (ret_fds == 0) {
-                boost::format    formatter( "up_thread_client_receive : epoll_wait timeout %d mS" );
-                formatter % epoll_timeout;
-                Logger::putLogInfo( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-                up_thread_next_call_function = up_thread_function_array[UP_FUNC_CLIENT_RECEIVE];
-                return;
-            }
-            else {
-                boost::format    formatter( "up_thread_client_receive : epoll_wait error : %d" );
-                formatter % strerror(errno);
-                Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-                up_thread_next_call_function = up_thread_function_array[UP_FUNC_CLIENT_DISCONNECT];
-                return;
-            }
-        }
-
-        for (int i = 0; i < ret_fds; ++i) {
-            if (up_client_events[i].data.fd == event.data.fd) {
-                if (up_client_events[i].events & EPOLLIN) {
-                    break;
-                }
-                else if (up_client_events[i].events & EPOLLHUP) {
-                    up_thread_next_call_function = up_thread_function_array[UP_FUNC_CLIENT_DISCONNECT];
-                    if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-                        boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_client_receive EPOLLHUP : NEXT_FUNC[%s]" );
-                        formatter % boost::this_thread::get_id() % func_tag_to_string( UP_FUNC_CLIENT_DISCONNECT );
-                        Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-                    }
-                    return;
-                }
-            }
-        }
+               if (is_epoll_edge_trigger && (!add_flag)) {
+                       if (epoll_ctl( up_client_epollfd, EPOLL_CTL_MOD, event.data.fd, &event ) < 0) {
+                               std::stringstream buf;
+                               buf << "up_thread_client_receive : epoll_ctl EPOLL_CTL_MOD error : ";
+                               buf << strerror(errno);
+                               Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, buf.str(), __FILE__, __LINE__ );
+                               up_thread_next_call_function = up_thread_function_array[UP_FUNC_CLIENT_DISCONNECT];
+                               return;
+                       }
+               }
+               int ret_fds = epoll_wait( up_client_epollfd, up_client_events, EVENT_NUM, epoll_timeout );
+               if (ret_fds <= 0) {
+                       if (ret_fds == 0) {
+                               boost::format   formatter( "up_thread_client_receive : epoll_wait timeout %d mS" );
+                               formatter % epoll_timeout;
+                               Logger::putLogInfo( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+                               up_thread_next_call_function = up_thread_function_array[UP_FUNC_CLIENT_RECEIVE];
+                               return;
+                       }
+                       else {
+                               boost::format   formatter( "up_thread_client_receive : epoll_wait error : %d" );
+                               formatter % strerror(errno);
+                               Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+                               up_thread_next_call_function = up_thread_function_array[UP_FUNC_CLIENT_DISCONNECT];
+                               return;
+                       }
+               }
+
+               for (int i = 0; i < ret_fds; ++i) {
+                       if (up_client_events[i].data.fd == event.data.fd) {
+                               if (up_client_events[i].events & EPOLLIN) {
+                                       break;
+                               }
+                               else if (up_client_events[i].events & EPOLLHUP) {
+                                       up_thread_next_call_function = up_thread_function_array[UP_FUNC_CLIENT_DISCONNECT];
+                                       if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                                               boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_client_receive EPOLLHUP : NEXT_FUNC[%s]" );
+                                               formatter % boost::this_thread::get_id() % func_tag_to_string( UP_FUNC_CLIENT_DISCONNECT );
+                                               Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+                                       }
+                                       return;
+                               }
+                       }
+               }
 //
-//    epoll_wait codes end
-
-        recv_size = !ssl_flag ? client_socket.read_some(
-                                    boost::asio::buffer(data_buff,MAX_BUFFER_SIZE),
-                                    ec)
-                              : client_ssl_socket.read_some(
-                                    boost::asio::buffer(data_buff,MAX_BUFFER_SIZE),
-                                    ec);
-
-        if (!ec) {
-            if (recv_size > 0) {
-                //----Debug log----------------------------------------------------------------------
-                if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
-                    boost::asio::ip::tcp::endpoint client_endpoint;
-                    client_endpoint = !ssl_flag ? client_socket.get_socket().lowest_layer().remote_endpoint(ec)
-                                                : client_ssl_socket.get_socket().lowest_layer().remote_endpoint(ec);
-                    boost::format    formatter( "Thread ID[%d] up_thread_client_receive receive data size[%d] from [%d]" );
-                    formatter % boost::this_thread::get_id() % recv_size % client_endpoint;
-                    Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 36, formatter.str(), __FILE__, __LINE__ );
-                }
-                //----Debug log----------------------------------------------------------------------
-                up_thread_data_client_side.set_size(recv_size);
-                parent_service.update_up_recv_size(recv_size);
-                protocol_module_base::EVENT_TAG module_event = protocol_module->handle_client_recv(up_thread_id,data_buff,recv_size);
-                std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-                if(unlikely( func_type == up_thread_module_event_map.end() )){
-                    //Error unknown protocol_module_base::EVENT_TAG return
-                    boost::format    formatter( "Thread ID[%d] protocol_module returnd illegal EVENT_TAG : %d" );
-                    formatter % boost::this_thread::get_id() % module_event;
-                    Logger::putLogError( LOG_CAT_L7VSD_SESSION, 20, formatter.str(), __FILE__, __LINE__ );
-                    up_thread_exit(process_type);
-                    return;
-                }
-                func_tag = func_type->second;
-            }
-            else{
-                func_tag = UP_FUNC_CLIENT_RECEIVE;
-                //boost::this_thread::yield();
-            }
-        }
-        else{
-            if(ec == boost::asio::error::try_again){
-                func_tag = UP_FUNC_CLIENT_RECEIVE;
-                //boost::this_thread::yield();
-            }
-            else{
-                func_tag = UP_FUNC_CLIENT_DISCONNECT;
-            }
-        }
-        up_thread_next_call_function  = up_thread_function_array[func_tag];
-
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_client_receive : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+//     epoll_wait codes end
+
+               ( !ssl_flag )   ?       recv_size = client_socket.read_some(boost::asio::buffer(data_buff,MAX_BUFFER_SIZE), ec)
+                                               :       recv_size = client_ssl_socket.read_some(boost::asio::buffer(data_buff,MAX_BUFFER_SIZE), ec);
+
+               if(!ec){
+                       if(recv_size > 0){
+                               //----Debug log----------------------------------------------------------------------
+                               if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
+                                       boost::asio::ip::tcp::endpoint client_endpoint;
+                                       (!ssl_flag) ?   client_endpoint = client_socket.get_socket().lowest_layer().remote_endpoint(ec)
+                                                               :       client_endpoint = client_ssl_socket.get_socket().lowest_layer().remote_endpoint(ec);
+                                       boost::format   formatter( "Thread ID[%d] up_thread_client_receive receive data size[%d] from [%d]" );
+                                       formatter % boost::this_thread::get_id() % recv_size % client_endpoint;
+                                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 36, formatter.str(), __FILE__, __LINE__ );
+                               }
+                               //----Debug log----------------------------------------------------------------------
+                               up_thread_data_client_side.set_size(recv_size);
+                               parent_service.update_up_recv_size(recv_size);
+                               protocol_module_base::EVENT_TAG module_event = protocol_module->handle_client_recv(up_thread_id,data_buff,recv_size);
+                               std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
+                               if(unlikely( func_type == up_thread_module_event_map.end() )){
+                                       //Error unknown protocol_module_base::EVENT_TAG return
+                                       boost::format   formatter( "Thread ID[%d] protocol_module returnd illegal EVENT_TAG : %d" );
+                                       formatter % boost::this_thread::get_id() % module_event;
+                                       Logger::putLogError( LOG_CAT_L7VSD_SESSION, 20, formatter.str(), __FILE__, __LINE__ );
+                                       up_thread_exit(process_type);
+                                       return;
+                               }
+                               func_tag = func_type->second;
+                       }
+                       else{
+                               func_tag = UP_FUNC_CLIENT_RECEIVE;
+                               //boost::this_thread::yield();
+                       }
+               }
+               else{
+                       if(ec == boost::asio::error::try_again){
+                               func_tag = UP_FUNC_CLIENT_RECEIVE;
+                               //boost::this_thread::yield();
+                       }
+                       else{
+                               func_tag = UP_FUNC_CLIENT_DISCONNECT;
+                       }
+               }
+               up_thread_next_call_function  = up_thread_function_array[func_tag];
+
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_client_receive : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise client respond send event message for up and down thread
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_client_respond(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_client_respond" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_client_respond" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
-        tcp_thread_message*        up_msg    = new tcp_thread_message;
-        tcp_thread_message*        down_msg    = new tcp_thread_message;
-        up_thread_function_pair    up_func    = up_thread_function_array[UP_FUNC_CLIENT_RESPOND_SEND_EVENT];
+        tcp_thread_message*        up_msg      = new tcp_thread_message;
+        tcp_thread_message*        down_msg    = new tcp_thread_message;
+        up_thread_function_pair    up_func     = up_thread_function_array[UP_FUNC_CLIENT_RESPOND_SEND_EVENT];
 
         up_msg->message = up_func.second;
         std::map< DOWN_THREAD_FUNC_TYPE_TAG, tcp_session_func >::iterator down_func = up_thread_message_down_thread_function_map.find(DOWN_FUNC_CLIENT_RESPOND_SEND_EVENT);
@@ -1518,20 +1518,20 @@ namespace l7vs {
         while(!up_thread_message_que.push(up_msg)){}
         while(!down_thread_message_que.push(down_msg)){}
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_client_respond" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_client_respond" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise module event of handle_response_send_inform
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_client_respond_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_client_respond_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_client_respond_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         {
@@ -1542,55 +1542,57 @@ namespace l7vs {
         up_thread_function_pair    func    = up_thread_function_array[func_type->second];
         up_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_client_respond_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_client_respond_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread close client socket and raise client disconnect event message for up and down thread
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_client_disconnect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN func up_thread_client_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN func up_thread_client_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::system::error_code ec;
-        bool bres = !ssl_flag ? client_socket.close(ec)
-                              : client_ssl_socket.close(ec);
+        bool bres;
+
+               (!ssl_flag)     ?       bres = client_socket.close(ec)
+                                       :       bres = client_ssl_socket.close(ec);
 
         if(bres){
-            tcp_thread_message*        up_msg    = new tcp_thread_message;
-            tcp_thread_message*        down_msg    = new tcp_thread_message;
-            up_thread_function_pair    up_func    = up_thread_function_array[UP_FUNC_CLIENT_DISCONNECT_EVENT];
+            tcp_thread_message*        up_msg  = new tcp_thread_message;
+            tcp_thread_message*        down_msg        = new tcp_thread_message;
+            up_thread_function_pair    up_func = up_thread_function_array[UP_FUNC_CLIENT_DISCONNECT_EVENT];
             up_msg->message = up_func.second;
 /*            std::map< DOWN_THREAD_FUNC_TYPE_TAG, tcp_session_func >::iterator down_func = up_thread_message_down_thread_function_map.find(DOWN_FUNC_CLIENT_DISCONNECT_EVENT);
             down_msg->message = down_func->second;
 */
-            down_thread_function_pair down_func = down_thread_function_array[DOWN_FUNC_CLIENT_DISCONNECT_EVENT];
-            down_msg->message = down_func.second;
+                       down_thread_function_pair       down_func       = down_thread_function_array[DOWN_FUNC_CLIENT_DISCONNECT_EVENT];
+                       down_msg->message = down_func.second;
 
             while(!up_thread_message_que.push(up_msg)){}
             while(!down_thread_message_que.push(down_msg)){}
         }
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC_OUT up_thread_client_disconnect up_func[%s] donw_func[%s]" );
-            formatter % boost::this_thread::get_id()
-                      % func_tag_to_string( UP_FUNC_CLIENT_DISCONNECT_EVENT )
-                      % func_tag_to_string( DOWN_FUNC_CLIENT_DISCONNECT_EVENT );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC_OUT up_thread_client_disconnect up_func[%s] donw_func[%s]" );
+                       formatter % boost::this_thread::get_id()
+                                         % func_tag_to_string( UP_FUNC_CLIENT_DISCONNECT_EVENT )
+                                         % func_tag_to_string( DOWN_FUNC_CLIENT_DISCONNECT_EVENT );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise module event of handle_client_disconnect
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_client_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_client_disconnect_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_client_disconnect_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
         protocol_module_base::EVENT_TAG module_event;
         {
             rw_scoped_lock scope_lock(module_function_client_disconnect_mutex);
@@ -1600,20 +1602,20 @@ namespace l7vs {
         up_thread_function_pair    func    = up_thread_function_array[func_type->second];
         up_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_client_disconnect_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_client_disconnect_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread send realserver and raise module event of handle_client_recv
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_realserver_send(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_realserver_send" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_realserver_send" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::system::error_code ec;
         boost::asio::ip::tcp::endpoint server_endpoint = up_thread_data_dest_side.get_endpoint();
@@ -1679,7 +1681,7 @@ namespace l7vs {
                     buf << strerror(errno);
                     Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, buf.str(), __FILE__, __LINE__ );
                 }
-                up_thread_next_call_function = up_thread_function_array[UP_FUNC_REALSERVER_DISCONNECT];
+                               up_thread_next_call_function = up_thread_function_array[UP_FUNC_REALSERVER_DISCONNECT];
                 return;
             }
 
@@ -1688,8 +1690,8 @@ namespace l7vs {
                     if (up_realserver_events[i].events & EPOLLOUT) {
                         break;
                     } else if (up_realserver_events[i].events & EPOLLHUP) {
-                        up_thread_next_call_function = up_thread_function_array[UP_FUNC_REALSERVER_DISCONNECT];
-                        return;
+                                               up_thread_next_call_function = up_thread_function_array[UP_FUNC_REALSERVER_DISCONNECT];
+                                               return;
                     }
                 }
             }
@@ -1702,8 +1704,8 @@ namespace l7vs {
                 parent_service.update_up_send_size(send_size);
                 //----Debug log----------------------------------------------------------------------
                 if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
-                    boost::format    formatter( "Thread ID[%d] up_thread_realserver_send send data size[%d] for [%d]" );
-                    formatter % boost::this_thread::get_id() % send_size % server_endpoint;
+                                       boost::format   formatter( "Thread ID[%d] up_thread_realserver_send send data size[%d] for [%d]" );
+                                       formatter % boost::this_thread::get_id() % send_size % server_endpoint;
                     Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 37, formatter.str(), __FILE__, __LINE__ );
                 }
                 //----Debug log----------------------------------------------------------------------
@@ -1726,23 +1728,23 @@ namespace l7vs {
             }
         }
 
-        up_thread_next_call_function = up_thread_function_array[func_tag];
+               up_thread_next_call_function = up_thread_function_array[func_tag];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_send : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_send : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
     }
     //! up thread raise module event of handle_realserver_select
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_realserver_get_destination_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_realserver_get_destination_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_realserver_get_destination_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::asio::ip::tcp::endpoint server_endpoint;
 
@@ -1765,20 +1767,20 @@ namespace l7vs {
 
         up_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_get_destination_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_get_destination_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread connect realserver
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_realserver_connect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_realserver_connect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_realserver_connect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::asio::ip::tcp::endpoint server_endpoint = up_thread_data_dest_side.get_endpoint();
         std::map<endpoint,tcp_socket_ptr>::iterator get_socket =  up_thread_send_realserver_socket_map.find(server_endpoint);
@@ -1871,25 +1873,25 @@ namespace l7vs {
             }
         }
         up_thread_function_pair    func    = up_thread_function_array[func_tag];
-        boost::mutex::scoped_lock    lock( realserver_connect_mutex );
+        boost::mutex::scoped_lock      lock( realserver_connect_mutex );
         realserver_connect_status = true;
         realserver_connect_cond.notify_one();
         up_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_connect : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_connect : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise module event of handle_realserver_connect
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_realserver_connect_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_realserver_connect_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_realserver_connect_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         endpoint server_endpoint = up_thread_data_dest_side.get_endpoint();
         up_thread_data_dest_side.initialize();
@@ -1899,42 +1901,42 @@ namespace l7vs {
         up_thread_data_dest_side.set_endpoint(server_endpoint);
         up_thread_data_dest_side.set_size(data_size);
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-        up_thread_next_call_function = up_thread_function_array[func_type->second];
+               up_thread_next_call_function = up_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_connect_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_connect_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise module event of handle_realserver_connection_fail
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_realserver_connection_fail_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_realserver_connection_fail_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_realserver_connection_fail_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         endpoint server_endpoint = up_thread_data_dest_side.get_endpoint();
         protocol_module_base::EVENT_TAG module_event = protocol_module->handle_realserver_connection_fail(up_thread_id,server_endpoint);
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-        up_thread_next_call_function = up_thread_function_array[func_type->second];
+               up_thread_next_call_function = up_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_connection_fail_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_connection_fail_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread close realserver socket and raise realserver disconnect event message for up and down thread
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_realserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_realserver_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_realserver_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::asio::ip::tcp::endpoint server_endpoint = up_thread_data_dest_side.get_endpoint();
         std::map<endpoint,tcp_socket_ptr>::iterator close_socket = up_thread_send_realserver_socket_map.find(server_endpoint);
@@ -1954,20 +1956,20 @@ namespace l7vs {
             while(!down_thread_message_que.push(down_msg)){}
         }
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise module event of handle_client_disconnect
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_realserver_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_realserver_disconnect_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_realserver_disconnect_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         boost::asio::ip::tcp::endpoint server_endpoint = up_thread_message_data.get_endpoint();
@@ -1978,22 +1980,22 @@ namespace l7vs {
         up_thread_send_realserver_socket_map.erase(server_endpoint);
         
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-        up_thread_next_call_function = up_thread_function_array[func_type->second];
+               up_thread_next_call_function = up_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_disconnect_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_realserver_disconnect_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread close all realserver socket and raise module event of handle_realserver_disconnect
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_all_realserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_all_realserver_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_all_realserver_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         std::map<endpoint,tcp_socket_ptr>::iterator close_socket = up_thread_send_realserver_socket_map.begin();
         std::map<endpoint,tcp_socket_ptr>::iterator list_end = up_thread_send_realserver_socket_map.end();
@@ -2031,27 +2033,27 @@ namespace l7vs {
         }
         up_thread_send_realserver_socket_map.clear();
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-        up_thread_next_call_function = up_thread_function_array[func_type->second];
-
-        //allrealserver_disconnect.
-        boost::mutex::scoped_lock    lock( realserver_connect_mutex );
-        realserver_connect_status = true;
-        realserver_connect_cond.notify_all();
-
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_all_realserver_disconnect : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               up_thread_next_call_function = up_thread_function_array[func_type->second];
+
+               //allrealserver_disconnect.
+               boost::mutex::scoped_lock       lock( realserver_connect_mutex );
+               realserver_connect_status = true;
+               realserver_connect_cond.notify_all();
+
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_all_realserver_disconnect : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread send sorryserver and raise module event of handle_sorryserver_send
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_sorryserver_send(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_send" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_send" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::system::error_code ec;
         boost::asio::ip::tcp::endpoint sorry_endpoint = up_thread_data_dest_side.get_endpoint();
@@ -2116,7 +2118,7 @@ namespace l7vs {
                     buf << strerror(errno);
                     Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, buf.str(), __FILE__, __LINE__ );
                 }
-                up_thread_next_call_function = up_thread_function_array[UP_FUNC_SORRYSERVER_DISCONNECT];
+                               up_thread_next_call_function = up_thread_function_array[UP_FUNC_SORRYSERVER_DISCONNECT];
                 return;
             }
 
@@ -2125,8 +2127,8 @@ namespace l7vs {
                     if (up_sorryserver_events[i].events & EPOLLOUT) {
                         break;
                     } else if (up_sorryserver_events[i].events & EPOLLHUP) {
-                        up_thread_next_call_function = up_thread_function_array[UP_FUNC_SORRYSERVER_DISCONNECT];
-                        return;
+                                               up_thread_next_call_function = up_thread_function_array[UP_FUNC_SORRYSERVER_DISCONNECT];
+                                               return;
                     }
                 }
             }
@@ -2180,22 +2182,22 @@ namespace l7vs {
             }
         }
 
-        up_thread_next_call_function = up_thread_function_array[func_tag];
+               up_thread_next_call_function = up_thread_function_array[func_tag];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_send : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_send : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise module event of handle_sorryserver_select
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_sorryserver_get_destination_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_get_destination_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_get_destination_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::asio::ip::tcp::endpoint server_endpoint;
         virtualservice_element& vs_element = parent_service.get_element();
@@ -2204,22 +2206,22 @@ namespace l7vs {
         up_thread_data_dest_side.set_endpoint(server_endpoint);
         
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-        up_thread_next_call_function = up_thread_function_array[func_type->second];
+               up_thread_next_call_function = up_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_get_destination_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_get_destination_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread connect sorryserver
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_sorryserver_connect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_connect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_connect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::asio::ip::tcp::endpoint sorry_endpoint = up_thread_data_dest_side.get_endpoint();
         boost::system::error_code ec;
@@ -2248,22 +2250,22 @@ namespace l7vs {
             buf << ec.message();
             Logger::putLogError( LOG_CAT_L7VSD_SESSION, 54, buf.str(), __FILE__, __LINE__ );
         }
-        up_thread_next_call_function = up_thread_function_array[func_tag];
+               up_thread_next_call_function = up_thread_function_array[func_tag];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_connect : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_connect : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise module event of handle_sorryserver_connect
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_sorryserver_connect_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_connect_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_connect_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         endpoint sorry_endpoint = up_thread_data_dest_side.get_endpoint();
         up_thread_data_dest_side.initialize();
@@ -2275,40 +2277,40 @@ namespace l7vs {
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
         up_thread_next_call_function = up_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_connect_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_connect_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise module event of handle_sorryserver_connection_fail
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_sorryserver_connection_fail_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_connection_fail_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_connection_fail_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         endpoint server_endpoint = up_thread_data_dest_side.get_endpoint();
         protocol_module_base::EVENT_TAG module_event = protocol_module->handle_sorryserver_connection_fail(up_thread_id,server_endpoint);
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-        up_thread_next_call_function = up_thread_function_array[func_type->second];
+               up_thread_next_call_function = up_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_connection_fail_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_connection_fail_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread close sorryserver socket and raise sorryserver disconnect event message for up and down thread
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_sorryserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::system::error_code ec;
         bool bres = sorryserver_socket.second->close(ec);
@@ -2325,20 +2327,20 @@ namespace l7vs {
             while(!down_thread_message_que.push(down_msg)){}
         }
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread close sorryserver socket and raise module sorryserver disconnect event
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_sorryserver_mod_disconnect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_mod_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_mod_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         
@@ -2353,23 +2355,23 @@ namespace l7vs {
             module_event = protocol_module->handle_sorryserver_disconnect(up_thread_id,sorry_endpoint);
         }
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-        up_thread_next_call_function = up_thread_function_array[func_type->second];
+               up_thread_next_call_function = up_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_mod_disconnect : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_mod_disconnect : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
 
     //! up thread raise module event of handle_sorryserver_disconnect
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_sorryserver_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_disconnect_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_sorryserver_disconnect_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         boost::asio::ip::tcp::endpoint sorry_endpoint = up_thread_message_data.get_endpoint();
@@ -2378,22 +2380,22 @@ namespace l7vs {
             module_event = protocol_module->handle_sorryserver_disconnect(up_thread_id,sorry_endpoint);
         }
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-        up_thread_next_call_function = up_thread_function_array[func_type->second];
+               up_thread_next_call_function = up_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_disconnect_event NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_sorryserver_disconnect_event NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise module event of handle_sorry_enable
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_sorry_enable_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_sorry_enable_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_sorry_enable_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         {
@@ -2410,22 +2412,22 @@ namespace l7vs {
             module_event = protocol_module->handle_sorry_enable(up_thread_id);
         }
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-        up_thread_next_call_function = up_thread_function_array[func_type->second];
+               up_thread_next_call_function = up_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_sorry_enable_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_sorry_enable_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread raise module event of handle_sorry_disable
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_sorry_disable_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_sorry_disable_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_sorry_disable_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         {
@@ -2442,44 +2444,44 @@ namespace l7vs {
             module_event = protocol_module->handle_sorry_disable(up_thread_id);
         }
         std::map< protocol_module_base::EVENT_TAG ,UP_THREAD_FUNC_TYPE_TAG >::iterator func_type = up_thread_module_event_map.find(module_event);
-        up_thread_next_call_function = up_thread_function_array[func_type->second];
+               up_thread_next_call_function = up_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_sorry_disable_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_sorry_disable_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     
     //! up thread exit main loop
     //! @param[in]        process_type is prosecess type
     void tcp_session::up_thread_exit(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN func up_thread_exit" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN func up_thread_exit" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
         rw_scoped_lock scoped_lock(exit_flag_update_mutex);
-        boost::mutex::scoped_lock    down_thread_cond_lock( downthread_status_mutex );
-        boost::mutex::scoped_lock    realserver_status_lock( realserver_connect_mutex );
-        downthread_status_cond.notify_all();
-        realserver_connect_cond.notify_all();
-        realserver_connect_status = true;
+               boost::mutex::scoped_lock       down_thread_cond_lock( downthread_status_mutex );
+               boost::mutex::scoped_lock       realserver_status_lock( realserver_connect_mutex );
+               downthread_status_cond.notify_all();
+               realserver_connect_cond.notify_all();
+               realserver_connect_status = true;
         exit_flag = true;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT func up_thread_client_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT func up_thread_client_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! up thread close all socket
     void tcp_session::up_thread_all_socket_close(void){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN up_thread_all_socket_close" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN up_thread_all_socket_close" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         std::map<endpoint,tcp_socket_ptr>::iterator close_socket = up_thread_send_realserver_socket_map.begin();
         std::map<endpoint,tcp_socket_ptr>::iterator list_end = up_thread_send_realserver_socket_map.end();
@@ -2492,45 +2494,41 @@ namespace l7vs {
         }
         up_thread_send_realserver_socket_map.clear();
         down_thread_connect_socket_list.clear();
-
-        if (!ssl_flag)
-            client_socket.close(ec)
-        else
-            client_ssl_socket.close(ec);
-
+               (!ssl_flag)     ?       client_socket.close(ec)
+                                       :       client_ssl_socket.close(ec);
         sorryserver_socket.second->close(ec);
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT up_thread_all_socket_close" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT up_thread_all_socket_close" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
 
     //! down thread receive from realserver and raise module event of handle_
 
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_realserver_receive(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_realserver_receive" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_realserver_receive" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         if( down_thread_receive_realserver_socket_list.empty() ){
-            if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-                boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_realserver_receive" );
-                formatter % boost::this_thread::get_id();
-                Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-            }
-            boost::mutex::scoped_lock    lock( realserver_connect_mutex );
-            if( !realserver_connect_status ){
-                    to_time( LOCKTIMEOUT, xt );
-                    realserver_connect_cond.timed_wait( lock, xt );
-            }
-            down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_REALSERVER_RECEIVE];
-            return;
-        }
+                       if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                               boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_realserver_receive" );
+                               formatter % boost::this_thread::get_id();
+                               Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+                       }
+                       boost::mutex::scoped_lock       lock( realserver_connect_mutex );
+                       if( !realserver_connect_status ){
+                                       to_time( LOCKTIMEOUT, xt );
+                                       realserver_connect_cond.timed_wait( lock, xt );
+                       }
+                       down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_REALSERVER_RECEIVE];
+                       return;
+               }
 
         if(unlikely( 0 < parent_service.get_wait_downstream() ) ){
             //----Debug log----------------------------------------------------------------------
@@ -2571,92 +2569,92 @@ namespace l7vs {
             add_flag = true;
         }
 
-        if (is_epoll_edge_trigger && (!add_flag)) {
-            if (epoll_ctl( down_realserver_epollfd, EPOLL_CTL_MOD, event.data.fd, &event ) < 0) {
-                std::stringstream buf;
-                buf << "down_thread_realserver_receive : epoll_ctl EPOLL_CTL_MOD error : ";
-                buf << strerror(errno);
-                Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, buf.str(), __FILE__, __LINE__ );
-                boost::this_thread::yield();
-                return;
-            }
-        }
-
-        int ret_fds = epoll_wait( down_realserver_epollfd, down_realserver_events, EVENT_NUM, epoll_timeout );
-        if (ret_fds <= 0) {
-            if (ret_fds == 0) {
-                boost::format    formatter( "down_thread_realserver_receive : epoll_wait timeout %d mS" );
-                formatter % epoll_timeout;
-                Logger::putLogInfo( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-                down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_REALSERVER_RECEIVE];
-                return;    
-            } else {
-                boost::format    formatter( "down_thread_realserver_receive : epoll_wait error : %d " );
-                formatter % strerror(errno);
-                Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-                down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_REALSERVER_DISCONNECT];
-                return;
-            }
-        }
-
-        for (int i = 0; i < ret_fds; ++i) {
-            if (down_realserver_events[i].data.fd == event.data.fd) {
-                if (down_realserver_events[i].events & EPOLLIN) {
-                    break;
-                }
-                else if (down_realserver_events[i].events & EPOLLHUP) {
-                    down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_REALSERVER_DISCONNECT];
-                    if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-                        boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_realserver_receive: EPOLL_HUP" );
-                        formatter % boost::this_thread::get_id();
-                    }
-                    return;
-                }
-            }
-        }
-
-        recv_size = down_thread_current_receive_realserver_socket->second->read_some(boost::asio::buffer(data_buff,MAX_BUFFER_SIZE),ec);
-
-        boost::asio::ip::tcp::endpoint server_endpoint = down_thread_current_receive_realserver_socket->first;
-        down_thread_data_dest_side.set_endpoint(server_endpoint);
-        if(!ec){
-            if(recv_size > 0){
-                //----Debug log----------------------------------------------------------------------
-                if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
-                std::stringstream buf;
-                    buf << "Thread ID[";
-                    buf << boost::this_thread::get_id();
-                    buf << "] down_thread_realserver_receive";
-                    buf << " receive data size[";
-                    buf << recv_size;
-                    buf << "] from [";
-                    buf << server_endpoint;
-                    buf << "]";
-                    Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 43, buf.str(), __FILE__, __LINE__ );
-                }
-                //----Debug log----------------------------------------------------------------------
-                down_thread_data_dest_side.set_size(recv_size);
-                parent_service.update_down_recv_size(recv_size);
-
-                protocol_module_base::EVENT_TAG module_event = protocol_module->handle_realserver_recv(down_thread_id,server_endpoint,data_buff,recv_size);
-
-                std::map< protocol_module_base::EVENT_TAG ,DOWN_THREAD_FUNC_TYPE_TAG >::iterator func_type = down_thread_module_event_map.find(module_event);
-                func_tag = func_type->second;
-            }
-            else{
-                func_tag = DOWN_FUNC_REALSERVER_RECEIVE;
-                //boost::this_thread::yield();
-            }
-        }
-        else{
-            if(ec == boost::asio::error::try_again){
-                func_tag = DOWN_FUNC_REALSERVER_RECEIVE;
-                //boost::this_thread::yield();
-            }
-            else{
-                func_tag = DOWN_FUNC_REALSERVER_DISCONNECT;
-            }
-        }
+               if (is_epoll_edge_trigger && (!add_flag)) {
+                       if (epoll_ctl( down_realserver_epollfd, EPOLL_CTL_MOD, event.data.fd, &event ) < 0) {
+                               std::stringstream buf;
+                               buf << "down_thread_realserver_receive : epoll_ctl EPOLL_CTL_MOD error : ";
+                               buf << strerror(errno);
+                               Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, buf.str(), __FILE__, __LINE__ );
+                               boost::this_thread::yield();
+                               return;
+                       }
+               }
+
+               int ret_fds = epoll_wait( down_realserver_epollfd, down_realserver_events, EVENT_NUM, epoll_timeout );
+               if (ret_fds <= 0) {
+                       if (ret_fds == 0) {
+                               boost::format   formatter( "down_thread_realserver_receive : epoll_wait timeout %d mS" );
+                               formatter % epoll_timeout;
+                               Logger::putLogInfo( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+                               down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_REALSERVER_RECEIVE];
+                               return; 
+                       } else {
+                               boost::format   formatter( "down_thread_realserver_receive : epoll_wait error : %d " );
+                               formatter % strerror(errno);
+                               Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+                               down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_REALSERVER_DISCONNECT];
+                               return;
+                       }
+               }
+
+               for (int i = 0; i < ret_fds; ++i) {
+                       if (down_realserver_events[i].data.fd == event.data.fd) {
+                               if (down_realserver_events[i].events & EPOLLIN) {
+                                       break;
+                               }
+                               else if (down_realserver_events[i].events & EPOLLHUP) {
+                                       down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_REALSERVER_DISCONNECT];
+                                       if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                                               boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_realserver_receive: EPOLL_HUP" );
+                                               formatter % boost::this_thread::get_id();
+                                       }
+                                       return;
+                               }
+                       }
+               }
+
+               recv_size = down_thread_current_receive_realserver_socket->second->read_some(boost::asio::buffer(data_buff,MAX_BUFFER_SIZE),ec);
+
+               boost::asio::ip::tcp::endpoint server_endpoint = down_thread_current_receive_realserver_socket->first;
+               down_thread_data_dest_side.set_endpoint(server_endpoint);
+               if(!ec){
+                       if(recv_size > 0){
+                               //----Debug log----------------------------------------------------------------------
+                               if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
+                               std::stringstream buf;
+                                       buf << "Thread ID[";
+                                       buf << boost::this_thread::get_id();
+                                       buf << "] down_thread_realserver_receive";
+                                       buf << " receive data size[";
+                                       buf << recv_size;
+                                       buf << "] from [";
+                                       buf << server_endpoint;
+                                       buf << "]";
+                                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 43, buf.str(), __FILE__, __LINE__ );
+                               }
+                               //----Debug log----------------------------------------------------------------------
+                               down_thread_data_dest_side.set_size(recv_size);
+                               parent_service.update_down_recv_size(recv_size);
+
+                               protocol_module_base::EVENT_TAG module_event = protocol_module->handle_realserver_recv(down_thread_id,server_endpoint,data_buff,recv_size);
+
+                               std::map< protocol_module_base::EVENT_TAG ,DOWN_THREAD_FUNC_TYPE_TAG >::iterator func_type = down_thread_module_event_map.find(module_event);
+                               func_tag = func_type->second;
+                       }
+                       else{
+                               func_tag = DOWN_FUNC_REALSERVER_RECEIVE;
+                               //boost::this_thread::yield();
+                       }
+               }
+               else{
+                       if(ec == boost::asio::error::try_again){
+                               func_tag = DOWN_FUNC_REALSERVER_RECEIVE;
+                               //boost::this_thread::yield();
+                       }
+                       else{
+                               func_tag = DOWN_FUNC_REALSERVER_DISCONNECT;
+                       }
+               }
 
         down_thread_function_pair    func    = down_thread_function_array[func_tag];
         down_thread_current_receive_realserver_socket++;
@@ -2665,20 +2663,20 @@ namespace l7vs {
             down_thread_current_receive_realserver_socket = down_thread_receive_realserver_socket_list.begin();
         down_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_realserver_receive : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_realserver_receive : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread close realserver socket and raise realserver disconnect event message for up and down thread
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_realserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_realserver_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_realserver_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::asio::ip::tcp::endpoint server_endpoint = down_thread_data_dest_side.get_endpoint();
         std::list<socket_element>::iterator list_end = down_thread_receive_realserver_socket_list.end();
@@ -2706,21 +2704,21 @@ namespace l7vs {
             close_socket++;
         }
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_realserver_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_realserver_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     
     //! down thread raise module event of handle_realserver_disconnect
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_realserver_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_realserver_disconnect_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_realserver_disconnect_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         boost::asio::ip::tcp::endpoint server_endpoint = down_thread_message_data.get_endpoint();
@@ -2741,22 +2739,22 @@ namespace l7vs {
         }
         
         std::map< protocol_module_base::EVENT_TAG ,DOWN_THREAD_FUNC_TYPE_TAG >::iterator func_type = down_thread_module_event_map.find(module_event);
-        down_thread_next_call_function = down_thread_function_array[func_type->second];
+               down_thread_next_call_function = down_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_realserver_disconnect_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_realserver_disconnect_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread close realserver socket and raise realserver disconnect event message for up and down thread
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_all_realserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_all_realserver_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_all_realserver_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         std::list<socket_element>::iterator close_socket = down_thread_receive_realserver_socket_list.begin();
         std::list<socket_element>::iterator list_end = down_thread_receive_realserver_socket_list.end();
@@ -2794,22 +2792,22 @@ namespace l7vs {
         }
         down_thread_receive_realserver_socket_list.clear();
         std::map< protocol_module_base::EVENT_TAG ,DOWN_THREAD_FUNC_TYPE_TAG >::iterator func_type = down_thread_module_event_map.find(module_event);
-        down_thread_next_call_function = down_thread_function_array[func_type->second];
+               down_thread_next_call_function = down_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_all_realserver_disconnect : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_type->second;
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_all_realserver_disconnect : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_type->second;
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread raise module event of handle_client_connection_check
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_client_connection_chk_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_client_connection_chk_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_client_connection_chk_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         down_thread_data_client_side.initialize();
         boost::array<char,MAX_BUFFER_SIZE>& data_buff = down_thread_data_client_side.get_data();
@@ -2817,23 +2815,23 @@ namespace l7vs {
         protocol_module_base::EVENT_TAG module_event = protocol_module->handle_client_connection_check(down_thread_id,data_buff,data_size);
         down_thread_data_client_side.set_size(data_size);
         std::map< protocol_module_base::EVENT_TAG ,DOWN_THREAD_FUNC_TYPE_TAG >::iterator func_type = down_thread_module_event_map.find(module_event);
-        down_thread_next_call_function = down_thread_function_array[func_type->second];
+               down_thread_next_call_function = down_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_client_connection_chk_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_client_connection_chk_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     
     //! down thread raise module event of handle_response_send_inform
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_client_respond_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_client_respond_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_client_respond_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         {
@@ -2841,22 +2839,22 @@ namespace l7vs {
             module_event = protocol_module->handle_response_send_inform(down_thread_id);
         }
         std::map< protocol_module_base::EVENT_TAG ,DOWN_THREAD_FUNC_TYPE_TAG >::iterator func_type = down_thread_module_event_map.find(module_event);
-        down_thread_next_call_function = down_thread_function_array[func_type->second];
+               down_thread_next_call_function = down_thread_function_array[func_type->second];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_client_respond_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_client_respond_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread send for client and raise module event of handle_client_send
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_client_send(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_client_send" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_client_send" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::system::error_code ec;
         boost::array<char,MAX_BUFFER_SIZE>& data_buff = down_thread_data_client_side.get_data();
@@ -2866,8 +2864,8 @@ namespace l7vs {
         DOWN_THREAD_FUNC_TYPE_TAG func_tag;
 
         struct epoll_event event;
-        event.data.fd = !ssl_flag ? client_socket.get_socket().native()
-                                  : client_ssl_socket.get_socket().lowest_layer().native();
+               ( !ssl_flag )   ?       event.data.fd = client_socket.get_socket().native()
+                                               :       event.data.fd = client_ssl_socket.get_socket().lowest_layer().native();
 
         if (is_epoll_edge_trigger) {
             event.events = EPOLLET | EPOLLOUT | EPOLLHUP;
@@ -2922,7 +2920,7 @@ namespace l7vs {
                     buf << strerror(errno);
                     Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, buf.str(), __FILE__, __LINE__ );
                 }
-                down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_CLIENT_DISCONNECT];
+                               down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_CLIENT_DISCONNECT];
                 return;
             }
 
@@ -2931,33 +2929,26 @@ namespace l7vs {
                     if (down_client_events[i].events & EPOLLOUT) {
                         break;
                     } else if (down_client_events[i].events & EPOLLHUP) {
-                        down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_CLIENT_DISCONNECT];
-                        return;
+                                               down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_CLIENT_DISCONNECT];
+                                               return;
                     }
                 }
             }
 
-            send_size = !ssl_flag ? client_socket.write_some(
-                                        boost::asio::buffer(
-                                            data_buff.data() + send_data_size,
-                                            data_size - send_data_size),
-                                        ec)
-                                  : client_ssl_socket.write_some(
-                                        boost::asio::buffer(
-                                            data_buff.data()+send_data_size,
-                                            data_size-send_data_size),
-                                        ec);
+                       (!ssl_flag)     ?       send_size = client_socket.write_some(boost::asio::buffer(data_buff.data()+send_data_size,data_size-send_data_size),ec)
+                                               :       send_size = client_ssl_socket.write_some(boost::asio::buffer(data_buff.data()+send_data_size,data_size-send_data_size),ec);
+
             if(!ec){
                 send_data_size += send_size;
                 down_thread_data_client_side.set_send_size(send_data_size);
                 parent_service.update_down_send_size(send_size);
                 //----Debug log----------------------------------------------------------------------
                 if (unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION))){
-                    boost::asio::ip::tcp::endpoint client_endpoint
-                        = !ssl_flag ? client_socket.get_socket().lowest_layer().remote_endpoint(ec)
-                                    : client_ssl_socket.get_socket().lowest_layer().remote_endpoint(ec);
-                    boost::format    formatter( "Thread ID[%d] down_thread_client_send send data size[%d] for [%d]" );
-                    formatter % boost::this_thread::get_id() % send_size % client_endpoint;
+                    boost::asio::ip::tcp::endpoint client_endpoint;
+                    (!ssl_flag)        ?       client_endpoint = client_socket.get_socket().lowest_layer().remote_endpoint(ec)
+                                                               :       client_endpoint = client_ssl_socket.get_socket().lowest_layer().remote_endpoint(ec);
+                                       boost::format   formatter( "Thread ID[%d] down_thread_client_send send data size[%d] for [%d]" );
+                                       formatter % boost::this_thread::get_id() % send_size % client_endpoint;
                     Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 45, formatter.str(), __FILE__, __LINE__ );
                 }
                 //----Debug log----------------------------------------------------------------------
@@ -2983,23 +2974,24 @@ namespace l7vs {
 
         down_thread_next_call_function = down_thread_function_array[func_tag];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_client_send : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_client_send : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread close client socket and raise client disconnect event message for up and down thread 
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_client_disconnect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_client_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_client_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
         boost::system::error_code ec;
-        bool bres = !ssl_flag ? client_socket.close(ec)
-                              : client_ssl_socket.close(ec);
+        bool bres;
+               (!ssl_flag)     ?       bres = client_socket.close(ec)
+                                       :       bres = client_ssl_socket.close(ec);
         if(bres){
             tcp_thread_message*        up_msg        = new tcp_thread_message;
             tcp_thread_message*        down_msg    = new tcp_thread_message;
@@ -3011,21 +3003,21 @@ namespace l7vs {
             while(!up_thread_message_que.push(up_msg)){}
         }
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_client_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_client_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     
     //! down thread raise module event of handle_client_disconnect
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_client_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_disconnect_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_disconnect_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         {
@@ -3033,24 +3025,24 @@ namespace l7vs {
             module_event = protocol_module->handle_client_disconnect(down_thread_id);
         }
         std::map< protocol_module_base::EVENT_TAG ,DOWN_THREAD_FUNC_TYPE_TAG >::iterator func_type =
-             down_thread_module_event_map.find(module_event);
-        down_thread_function_pair    func    = down_thread_function_array[func_type->second];
+                        down_thread_module_event_map.find(module_event);
+        down_thread_function_pair      func    = down_thread_function_array[func_type->second];
         down_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_exit : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_exit : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread receive from sorryserver and raise module event of handle_sorryserver_recv
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_sorryserver_receive(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_sorryserver_receive" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_sorryserver_receive" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         down_thread_data_dest_side.initialize();
         boost::array<char,MAX_BUFFER_SIZE>& data_buff = down_thread_data_dest_side.get_data();
@@ -3113,7 +3105,7 @@ namespace l7vs {
                     buf << strerror(errno);
                     Logger::putLogWarn( LOG_CAT_L7VSD_SESSION, 999, buf.str(), __FILE__, __LINE__ );
                 }
-                down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_SORRYSERVER_DISCONNECT];
+                               down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_SORRYSERVER_DISCONNECT];
                 return;
             }
 
@@ -3122,8 +3114,8 @@ namespace l7vs {
                     if (down_sorryserver_events[i].events & EPOLLIN) {
                         break;
                     } else if (down_sorryserver_events[i].events & EPOLLHUP) {
-                        down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_SORRYSERVER_DISCONNECT];
-                        return;
+                                               down_thread_next_call_function = down_thread_function_array[DOWN_FUNC_SORRYSERVER_DISCONNECT];
+                                               return;
                     }
                 }
             }
@@ -3153,33 +3145,33 @@ namespace l7vs {
                     std::map< protocol_module_base::EVENT_TAG ,DOWN_THREAD_FUNC_TYPE_TAG >::iterator func_type = down_thread_module_event_map.find(module_event);
                     func_tag = func_type->second;
                 }else{
-                    func_tag = DOWN_FUNC_SORRYSERVER_RECEIVE;
+                                       func_tag = DOWN_FUNC_SORRYSERVER_RECEIVE;
                 }
             }else{
                 if(ec == boost::asio::error::try_again){
-                    func_tag = DOWN_FUNC_SORRYSERVER_RECEIVE;
+                                       func_tag = DOWN_FUNC_SORRYSERVER_RECEIVE;
                 }else{
                     func_tag = DOWN_FUNC_SORRYSERVER_DISCONNECT;
                 }
             }
         }
 
-        down_thread_next_call_function = down_thread_function_array[func_tag];
+               down_thread_next_call_function = down_thread_function_array[func_tag];
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_sorryserver_receive : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_sorryserver_receive : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_tag );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread raise module event of handle_sorryserver_disconnect
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_sorryserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_sorryserver_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_sorryserver_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         boost::system::error_code ec;
         bool bres = sorryserver_socket.second->close(ec);
@@ -3196,20 +3188,20 @@ namespace l7vs {
             while(!down_thread_message_que.push(down_msg)){}
         }
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_sorryserver_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_sorryserver_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread close sorryserver socket and raise module sorryserver disconnect event
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_sorryserver_mod_disconnect(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_sorryserver_mod_disconnect" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_sorryserver_mod_disconnect" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
 
@@ -3228,20 +3220,20 @@ namespace l7vs {
         down_thread_function_pair    func    = down_thread_function_array[func_type->second];
         down_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_sorryserver_mod_disconnect : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_sorryserver_mod_disconnect : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread raise module event of handle_sorryserver_disconnect
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_sorryserver_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_sorryserver_disconnect_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_sorryserver_disconnect_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         boost::asio::ip::tcp::endpoint sorry_endpoint = down_thread_message_data.get_endpoint();
@@ -3253,20 +3245,20 @@ namespace l7vs {
         down_thread_function_pair    func    = down_thread_function_array[func_type->second];
         down_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_sorryserver_disconnect_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_sorryserver_disconnect_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread raise module event of handle_sorry_enable
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_sorry_enable_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_sorry_enable_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_sorry_enable_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         {
@@ -3286,20 +3278,20 @@ namespace l7vs {
         down_thread_function_pair    func    = down_thread_function_array[func_type->second];
         down_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_sorry_enable_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_sorry_enable_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread raise module event of handle_sorry_disable
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_sorry_disable_event(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_sorry_disable_event" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_sorry_disable_event" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         protocol_module_base::EVENT_TAG module_event;
         {
@@ -3319,38 +3311,38 @@ namespace l7vs {
         down_thread_function_pair    func    = down_thread_function_array[func_type->second];
         down_thread_next_call_function = func;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_sorry_disable_event : NEXT_FUNC[%s]" );
-            formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_sorry_disable_event : NEXT_FUNC[%s]" );
+                       formatter % boost::this_thread::get_id() % func_tag_to_string( func_type->second );
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread exit main loop
     //! @param[in]        process_type is prosecess type
     void tcp_session::down_thread_exit(const TCP_PROCESS_TYPE_TAG process_type){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_exit" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_exit" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
         rw_scoped_lock scoped_lock(exit_flag_update_mutex);
-        boost::mutex::scoped_lock    status_scoped_lock( downthread_status_mutex );
-        downthread_status_cond.notify_all();
+               boost::mutex::scoped_lock       status_scoped_lock( downthread_status_mutex );
+               downthread_status_cond.notify_all();
         exit_flag = true;
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_exit" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_exit" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
     //! down thread close all socket
     void tcp_session::down_thread_all_socket_close(void){
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC IN down_thread_all_socket_close" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC IN down_thread_all_socket_close" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
 
         std::list<socket_element>::iterator close_socket = down_thread_receive_realserver_socket_list.begin();
         std::list<socket_element>::iterator list_end = down_thread_receive_realserver_socket_list.end();
@@ -3362,28 +3354,26 @@ namespace l7vs {
             close_socket++;
         }
         down_thread_receive_realserver_socket_list.clear();
-        if (!ssl_flag)
-            client_socket.close(ec)
-        else
-            client_ssl_socket.close(ec);
+               (!ssl_flag) ?   client_socket.close(ec)
+                                       :       client_ssl_socket.close(ec);
         sorryserver_socket.second->close(ec);
 
-        if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
-            boost::format    formatter( "Thread ID[%d] FUNC OUT down_thread_all_socket_close" );
-            formatter % boost::this_thread::get_id();
-            Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
-        }
+               if( unlikely(LOG_LV_DEBUG == Logger::getLogLevel(LOG_CAT_L7VSD_SESSION) ) ){
+                       boost::format   formatter( "Thread ID[%d] FUNC OUT down_thread_all_socket_close" );
+                       formatter % boost::this_thread::get_id();
+                       Logger::putLogDebug( LOG_CAT_L7VSD_SESSION, 999, formatter.str(), __FILE__, __LINE__ );
+               }
     }
 
-    //! milliseconds to boost::xtime converter
-    void tcp_session::to_time( int in, boost::xtime& xt ){
-        boost::xtime_get( &xt, boost::TIME_UTC );
-        xt.sec += ( in / 1000 );
-        xt.nsec += ( in % 1000 ) * 1000000;
-        if( xt.nsec >= 1000000000 ){
-            xt.sec++;
-            xt.nsec -= 1000000000;
-        }
-    }
+       //! milliseconds to boost::xtime converter
+       void tcp_session::to_time( int in, boost::xtime& xt ){
+               boost::xtime_get( &xt, boost::TIME_UTC );
+               xt.sec += ( in / 1000 );
+               xt.nsec += ( in % 1000 ) * 1000000;
+               if( xt.nsec >= 1000000000 ){
+                       xt.sec++;
+                       xt.nsec -= 1000000000;
+               }
+       }
     
 }// namespace l7vs