mturk       2004/11/11 09:43:01

  Modified:    jk/native/common jk_ajp14.c
  Log:
  Add new trace macros and clean up some log messages.
  
  Revision  Changes    Path
  1.23      +86 -48    jakarta-tomcat-connectors/jk/native/common/jk_ajp14.c
  
  Index: jk_ajp14.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- jk_ajp14.c        10 Nov 2004 16:36:48 -0000      1.22
  +++ jk_ajp14.c        11 Nov 2004 17:43:01 -0000      1.23
  @@ -38,7 +38,7 @@
       jk_md5((const unsigned char *)s->entropy,
              (const unsigned char *)s->secret_key, s->computed_key);
   
  -    jk_log(l, JK_LOG_DEBUG, "Into ajp14_compute_md5 (%s/%s) -> (%s)\n",
  +    jk_log(l, JK_LOG_DEBUG, "(%s/%s) -> (%s)\n",
              s->entropy, s->secret_key, s->computed_key);
       JK_TRACE_EXIT(l);
   }
  @@ -63,21 +63,24 @@
       /*
        * LOGIN
        */
  -    if (jk_b_append_byte(msg, AJP14_LOGINIT_CMD))
  +    if (jk_b_append_byte(msg, AJP14_LOGINIT_CMD)) {
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
  -
  +    }
       /*
        * NEGOCIATION FLAGS
        */
  -    if (jk_b_append_long(msg, s->negociation))
  +    if (jk_b_append_long(msg, s->negociation)) {
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
  -
  +    }
       /*
        * WEB-SERVER NAME
        */
       if (jk_b_append_string(msg, s->web_server_name)) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_marshal_login_init_into_msgb - Error appending 
the web_server_name string\n");
  +               "failed appending the web_server_name string\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -103,7 +106,8 @@
       if (jk_b_get_bytes
           (msg, (unsigned char *)s->entropy, AJP14_ENTROPY_SEED_LEN) < 0) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_unmarshal_login_seed - can't get seed\n");
  +               "can't get seed\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -132,9 +136,10 @@
       /*
        * LOGIN
        */
  -    if (jk_b_append_byte(msg, AJP14_LOGCOMP_CMD))
  +    if (jk_b_append_byte(msg, AJP14_LOGCOMP_CMD)) {
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
  -
  +    }
       /*
        * COMPUTED-SEED
        */
  @@ -142,7 +147,8 @@
           (msg, (const unsigned char *)s->computed_key,
            AJP14_COMPUTED_KEY_LEN)) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_marshal_login_comp_into_msgb - Error appending 
the COMPUTED MD5 bytes\n");
  +               "failed appending the COMPUTED MD5 bytes\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -172,7 +178,8 @@
   
       if (nego == 0xFFFFFFFF) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_unmarshal_log_ok - can't get negociated data\n");
  +               "can't get negociated data\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -180,7 +187,8 @@
   
       if (!sname) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_unmarshal_log_ok - can't get servlet engine 
name\n");
  +               "can't get servlet engine name\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -191,7 +199,8 @@
   
       if (!s->servlet_engine_name) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_unmarshal_log_ok - can't malloc servlet engine 
name\n");
  +               "can't malloc servlet engine name\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -219,7 +228,8 @@
   
       if (status == 0xFFFFFFFF) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_unmarshal_log_nok - can't get failure code\n");
  +               "can't get failure code\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -251,9 +261,10 @@
       /*
        * SHUTDOWN CMD
        */
  -    if (jk_b_append_byte(msg, AJP14_SHUTDOWN_CMD))
  +    if (jk_b_append_byte(msg, AJP14_SHUTDOWN_CMD)) {
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
  -
  +    }
       /*
        * COMPUTED-SEED
        */
  @@ -261,7 +272,8 @@
           (msg, (const unsigned char *)s->computed_key,
            AJP14_COMPUTED_KEY_LEN)) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_marshal_shutdown_into_msgb - Error appending the 
COMPUTED MD5 bytes\n");
  +               "failed appending the COMPUTED MD5 bytes\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -286,7 +298,8 @@
   
       if (status == 0xFFFFFFFF) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_unmarshal_shutdown_nok - can't get failure 
code\n");
  +               "can't get failure code\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -316,22 +329,25 @@
       /*
        * UNKNOWN PACKET CMD
        */
  -    if (jk_b_append_byte(msg, AJP14_UNKNOW_PACKET_CMD))
  +    if (jk_b_append_byte(msg, AJP14_UNKNOW_PACKET_CMD)) {
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
  -
  +    }
       /*
        * UNHANDLED MESSAGE SIZE
        */
  -    if (jk_b_append_int(msg, (unsigned short)jk_b_get_len(unk)))
  +    if (jk_b_append_int(msg, (unsigned short)jk_b_get_len(unk))) {
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
  -
  +    }
       /*
        * UNHANDLED MESSAGE (Question : Did we have to send all the message or 
only part of)
        *                                       (           ie: only 1k max     
                                                           )
        */
       if (jk_b_append_bytes(msg, jk_b_get_buff(unk), jk_b_get_len(unk))) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_marshal_unknown_packet_into_msgb - Error 
appending the UNHANDLED MESSAGE\n");
  +               "failed appending the UNHANDLED MESSAGE\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -359,15 +375,17 @@
       /*
        * CONTEXT QUERY CMD
        */
  -    if (jk_b_append_byte(msg, AJP14_CONTEXT_QRY_CMD))
  +    if (jk_b_append_byte(msg, AJP14_CONTEXT_QRY_CMD)) {
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
  -
  +    }
       /*
        * VIRTUAL HOST CSTRING
        */
       if (jk_b_append_string(msg, virtual)) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_marshal_context_query_into_msgb - Error 
appending the virtual host string\n");
  +               "failed appending the virtual host string\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -398,12 +416,13 @@
   
       JK_TRACE_ENTER(l);
       jk_log(l, JK_LOG_DEBUG,
  -           "ajp14_unmarshal_context_info - get virtual %s for virtual %s\n",
  +           "get virtual %s for virtual %s\n",
              vname, c->virtual);
   
       if (!vname) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_unmarshal_context_info - can't get virtual 
hostname\n");
  +               "can't get virtual hostname\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -413,7 +432,8 @@
   
           if (context_set_virtual(c, vname) == JK_FALSE) {
               jk_log(l, JK_LOG_ERROR,
  -                   "Error ajp14_unmarshal_context_info - can't malloc 
virtual hostname\n");
  +                   "can't malloc virtual hostname\n");
  +            JK_TRACE_EXIT(l);
               return JK_FALSE;
           }
       }
  @@ -424,12 +444,13 @@
   
           if (!cname) {
               jk_log(l, JK_LOG_ERROR,
  -                   "Error ajp14_unmarshal_context_info - can't get 
context\n");
  +                   "can't get context\n");
  +            JK_TRACE_EXIT(l);
               return JK_FALSE;
           }
   
           jk_log(l, JK_LOG_DEBUG,
  -               "ajp14_unmarshal_context_info - get context %s for virtual 
%s\n",
  +               "get context %s for virtual %s\n",
                  cname, vname);
   
           /* grab all contexts up to empty one which indicate end of contexts 
*/
  @@ -440,8 +461,9 @@
   
           if (context_add_base(c, cname) == JK_FALSE) {
               jk_log(l, JK_LOG_ERROR,
  -                   "Error ajp14_unmarshal_context_info - can't add/set 
context %s\n",
  +                   "can't add/set context %s\n",
                      cname);
  +            JK_TRACE_EXIT(l);
               return JK_FALSE;
           }
   
  @@ -451,7 +473,8 @@
   
               if (!uri) {
                   jk_log(l, JK_LOG_ERROR,
  -                       "Error ajp14_unmarshal_context_info - can't get 
URI\n");
  +                       "can't get URI\n");
  +                JK_TRACE_EXIT(l);
                   return JK_FALSE;
               }
   
  @@ -466,8 +489,9 @@
   
               if (context_add_uri(c, cname, uri) == JK_FALSE) {
                   jk_log(l, JK_LOG_ERROR,
  -                       "Error ajp14_unmarshal_context_info - can't add/set 
uri (%s) for context %s\n",
  +                       "can't add/set uri (%s) for context %s\n",
                          uri, cname);
  +                JK_TRACE_EXIT(l);
                   return JK_FALSE;
               }
           }
  @@ -505,15 +529,17 @@
       /*
        * CONTEXT STATE CMD
        */
  -    if (jk_b_append_byte(msg, AJP14_CONTEXT_STATE_CMD))
  +    if (jk_b_append_byte(msg, AJP14_CONTEXT_STATE_CMD)) {
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
  -
  +    }
       /*
        * VIRTUAL HOST CSTRING
        */
       if (jk_b_append_string(msg, c->virtual)) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_marshal_context_state_into_msgb - Error 
appending the virtual host string\n");
  +               "failed appending the virtual host string\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -523,8 +549,9 @@
   
           if (!ci) {
               jk_log(l, JK_LOG_ERROR,
  -                   "Warning ajp14_marshal_context_state_into_msgb - unknown 
context %s\n",
  +                   "unknown context %s\n",
                      cname);
  +            JK_TRACE_EXIT(l);
               return JK_FALSE;
           }
   
  @@ -534,8 +561,9 @@
   
           if (jk_b_append_string(msg, cname)) {
               jk_log(l, JK_LOG_ERROR,
  -                   "Error ajp14_marshal_context_state_into_msgb - Error 
appending the context string %s\n",
  +                   "failed appending the context string %s\n",
                      cname);
  +            JK_TRACE_EXIT(l);
               return JK_FALSE;
           }
       }
  @@ -548,7 +576,9 @@
                */
               if (jk_b_append_string(msg, c->contexts[i]->cbase)) {
                   jk_log(l, JK_LOG_ERROR,
  -                       "Error ajp14_marshal_context_state_into_msgb - Error 
appending the context string\n");
  +                       "failed appending the context string %s\n",
  +                       c->contexts[i]->cbase);
  +                JK_TRACE_EXIT(l);
                   return JK_FALSE;
               }
           }
  @@ -558,7 +588,8 @@
   
       if (jk_b_append_string(msg, "")) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_marshal_context_state_into_msgb - Error 
appending end of contexts\n");
  +               "failed appending end of contexts\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -591,15 +622,17 @@
   
       if (!vname) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_unmarshal_context_state_reply - can't get 
virtual hostname\n");
  +               "can't get virtual hostname\n");
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
       /* Check if we speak about the correct virtual */
       if (strcmp(c->virtual, vname)) {
           jk_log(l, JK_LOG_ERROR,
  -               "Error ajp14_unmarshal_context_state_reply - incorrect 
virtual %s instead of %s\n",
  +               "incorrect virtual %s instead of %s\n",
                  vname, c->virtual);
  +        JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  @@ -610,7 +643,8 @@
   
           if (!cname) {
               jk_log(l, JK_LOG_ERROR,
  -                   "Error ajp14_unmarshal_context_state_reply - can't get 
context\n");
  +                   "can't get context\n");
  +            JK_TRACE_EXIT(l);
               return JK_FALSE;
           }
   
  @@ -621,15 +655,16 @@
   
           if (!ci) {
               jk_log(l, JK_LOG_ERROR,
  -                   "Error ajp14_unmarshal_context_state_reply - unknow 
context %s for virtual %s\n",
  +                   "unknow context %s for virtual %s\n",
                      cname, vname);
  +            JK_TRACE_EXIT(l);
               return JK_FALSE;
           }
   
           ci->status = jk_b_get_int(msg);
   
           jk_log(l, JK_LOG_DEBUG,
  -               "ajp14_unmarshal_context_state_reply - updated context %s to 
state %d\n",
  +               "updated context %s to state %d\n",
                  cname, ci->status);
       }
   
  @@ -649,6 +684,9 @@
   int ajp14_unmarshal_context_update_cmd(jk_msg_buf_t *msg,
                                          jk_context_t *c, jk_logger_t *l)
   {
  +    int rc;
       JK_TRACE_ENTER(l);
  -    return (ajp14_unmarshal_context_state_reply(msg, c, l));
  +    rc = ajp14_unmarshal_context_state_reply(msg, c, l);
  +    JK_TRACE_EXIT(l);
  +    return rc;
   }
  
  
  

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

Reply via email to