tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_msg_buff.c jk_msg_buff.h
Date Thu, 21 Apr 2005 12:04:18 GMT
mturk       2005/04/21 05:04:18

  Modified:    jk/native/common jk_ajp_common.c jk_msg_buff.c jk_msg_buff.h
  Log:
  Make jk_msg_buf_t structure public to skip the need for calling functions
  for accessing structure elements.
  
  Revision  Changes    Path
  1.101     +16 -16    jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c
  
  Index: jk_ajp_common.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- jk_ajp_common.c	21 Apr 2005 11:51:06 -0000	1.100
  +++ jk_ajp_common.c	21 Apr 2005 12:04:18 -0000	1.101
  @@ -621,7 +621,7 @@
           if (d->header_names && d->header_values) {
               unsigned i;
               for (i = 0; i < d->num_headers; i++) {
  -                unsigned short name = jk_b_pget_int(msg, jk_b_get_pos(msg));
  +                unsigned short name = jk_b_pget_int(msg, msg->pos);
   
                   if ((name & 0XFF00) == 0XA000) {
                       jk_b_get_int(msg);
  @@ -910,9 +910,9 @@
           return JK_FATAL_ERROR;
       }
   
  -    if ((rc = jk_tcp_socket_sendfull(ae->sd, jk_b_get_buff(msg),
  -                                     jk_b_get_len(msg))) > 0) {
  -        ae->endpoint.wr += jk_b_get_len(msg);
  +    if ((rc = jk_tcp_socket_sendfull(ae->sd, msg->buf,
  +                                     msg->len)) > 0) {
  +        ae->endpoint.wr += msg->len;
           JK_TRACE_EXIT(l);
           return JK_TRUE;
       }
  @@ -997,19 +997,19 @@
       msglen = ((head[2] & 0xff) << 8);
       msglen += (head[3] & 0xFF);
   
  -    if (msglen > jk_b_get_size(msg)) {
  +    if (msglen > msg->maxlen) {
           jk_log(l, JK_LOG_ERROR,
                  "wrong message size %d %d from %s",
  -               msglen, jk_b_get_size(msg),
  +               msglen, msg->maxlen,
                  jk_dump_hinfo(&ae->worker->worker_inet_addr, buf));
           JK_TRACE_EXIT(l);
           return JK_FALSE;
       }
   
  -    jk_b_set_len(msg, msglen);
  -    jk_b_set_pos(msg, 0);
  +    msg->len = msglen;
  +    msg->pos = 0;
   
  -    rc = jk_tcp_socket_recvfull(ae->sd, jk_b_get_buff(msg), msglen);
  +    rc = jk_tcp_socket_recvfull(ae->sd, msg->buf, msglen);
       if (rc < 0) {
           jk_log(l, JK_LOG_ERROR,
                  "ERROR: can't receive the response message from tomcat, "
  @@ -1089,7 +1089,7 @@
                                     jk_ws_service_t *r,
                                     jk_msg_buf_t *msg, int len, jk_logger_t *l)
   {
  -    unsigned char *read_buf = jk_b_get_buff(msg);
  +    unsigned char *read_buf = msg->buf;
   
       JK_TRACE_ENTER(l);
       jk_b_reset(msg);
  @@ -1125,7 +1125,7 @@
           }
       }
   
  -    jk_b_set_len(msg, jk_b_get_len(msg) + len);
  +    msg->len += len;
   
       JK_TRACE_EXIT(l);
       return len;
  @@ -1241,7 +1241,7 @@
       if (JK_IS_DEBUG_LEVEL(l))
           jk_log(l, JK_LOG_DEBUG,
                  "request body to send %d - request body to resend %d",
  -               ae->left_bytes_to_send, jk_b_get_len(op->reply) - AJP_HEADER_LEN);
  +               ae->left_bytes_to_send, op->reply->len - AJP_HEADER_LEN);
   
       /*
        * POST recovery job is done here and will work when data to 
  @@ -1252,7 +1252,7 @@
   
       /* Did we have something to resend (ie the op-post has been feeded previously */
   
  -    postlen = jk_b_get_len(op->post);
  +    postlen = op->post->len;
       if (postlen > AJP_HEADER_LEN) {
           if (ajp_connection_tcp_send_message(ae, op->post, l) != JK_TRUE) {
               jk_log(l, JK_LOG_ERROR, "Error resending request body (%d)",
  @@ -1268,7 +1268,7 @@
       }
       else if (s->reco_status == RECO_FILLED) {
           /* Recovery in LB MODE */
  -        postlen = jk_b_get_len(s->reco_buf);
  +        postlen = s->reco_buf->len;
   
           if (postlen > AJP_HEADER_LEN) {
               if (ajp_connection_tcp_send_message(ae, s->reco_buf, l) != JK_TRUE) {
  @@ -1361,7 +1361,7 @@
       case JK_AJP13_SEND_BODY_CHUNK:
           {
               unsigned len = (unsigned)jk_b_get_int(msg);
  -            if (!r->write(r, jk_b_get_buff(msg) + jk_b_get_pos(msg), len)) {
  +            if (!r->write(r, msg->buf + msg->pos, len)) {
                   jk_log(l, JK_LOG_INFO,
                          "Connection aborted or network problems");
                   JK_TRACE_EXIT(l);
  
  
  
  1.29      +1 -41     jakarta-tomcat-connectors/jk/native/common/jk_msg_buff.c
  
  Index: jk_msg_buff.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_msg_buff.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- jk_msg_buff.c	16 Feb 2005 11:42:46 -0000	1.28
  +++ jk_msg_buff.c	21 Apr 2005 12:04:18 -0000	1.29
  @@ -29,16 +29,6 @@
   #include "jk_msg_buff.h"
   #include "jk_logger.h"
   
  -struct jk_msg_buf_t
  -{
  -    jk_pool_t *pool;
  -
  -    unsigned char *buf;
  -    int pos;
  -    int len;
  -    int maxlen;
  -};
  -
   static char *jk_HEX = "0123456789ABCDEFX";
   
   /*
  @@ -146,36 +136,6 @@
       return 0;
   }
   
  -unsigned char *jk_b_get_buff(jk_msg_buf_t *msg)
  -{
  -    return msg->buf;
  -}
  -
  -unsigned int jk_b_get_pos(jk_msg_buf_t *msg)
  -{
  -    return msg->pos;
  -}
  -
  -void jk_b_set_pos(jk_msg_buf_t *msg, int pos)
  -{
  -    msg->pos = pos;
  -}
  -
  -unsigned int jk_b_get_len(jk_msg_buf_t *msg)
  -{
  -    return msg->len;
  -}
  -
  -void jk_b_set_len(jk_msg_buf_t *msg, int len)
  -{
  -    msg->len = len;
  -}
  -
  -int jk_b_get_size(jk_msg_buf_t *msg)
  -{
  -    return msg->maxlen;
  -}
  -
   #ifdef AS400
   int jk_b_append_asciistring(jk_msg_buf_t *msg, const char *param)
   {
  
  
  
  1.14      +10 -27    jakarta-tomcat-connectors/jk/native/common/jk_msg_buff.h
  
  Index: jk_msg_buff.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_msg_buff.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- jk_msg_buff.h	11 Nov 2004 09:45:23 -0000	1.13
  +++ jk_msg_buff.h	21 Apr 2005 12:04:18 -0000	1.14
  @@ -48,6 +48,15 @@
    */
   
   typedef struct jk_msg_buf_t jk_msg_buf_t;
  +struct jk_msg_buf_t
  +{
  +    jk_pool_t *pool;
  +    unsigned char *buf;
  +    int pos;
  +    int len;
  +    int maxlen;
  +};
  +
   
   /* -------------------- Setup routines -------------------- */
   
  @@ -74,32 +83,6 @@
    */
   void jk_b_reset(jk_msg_buf_t *msg);
   
  -/*
  - * Return the buffer body 
  - */
  -unsigned char *jk_b_get_buff(jk_msg_buf_t *msg);
  -
  -/* 
  - * Return the current reading position
  - */
  -unsigned int jk_b_get_pos(jk_msg_buf_t *msg);
  -
  -/*
  - * Buffer size 
  - */
  -int jk_b_get_size(jk_msg_buf_t *msg);
  -
  -void jk_b_set_len(jk_msg_buf_t *msg, int len);
  -
  -void jk_b_set_pos(jk_msg_buf_t *msg, int pos);
  -
  -/*
  - * Get the  message length for incomming buffers
  - *   or the current length for outgoing
  - */
  -unsigned int jk_b_get_len(jk_msg_buf_t *msg);
  -
  -
   /* -------------------- Real encoding -------------------- */
   
   int jk_b_append_byte(jk_msg_buf_t *msg, unsigned char val);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message