hgomez      2003/09/25 08:26:25

  Modified:    src/share/org/apache/tomcat/modules/server Ajp13.java
  Log:
  Update ajp13 support in TC 3.3.2 to handle PING/PONG.
  
  Ok, this code will be deprecated but for now ....
  
  Revision  Changes    Path
  1.34      +32 -2     
jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13.java
  
  Index: Ajp13.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- Ajp13.java        22 Sep 2003 09:18:37 -0000      1.33
  +++ Ajp13.java        25 Sep 2003 15:26:25 -0000      1.34
  @@ -104,7 +104,8 @@
   
       // Prefix codes for message types from server to container
       public static final byte JK_AJP13_FORWARD_REQUEST   = 2;
  -    public static final byte JK_AJP13_SHUTDOWN          = 7;
  +     public static final byte JK_AJP13_SHUTDOWN          = 7;
  +     public static final byte JK_AJP13_PING_REQUEST      = 8;
        
       // Error code for Ajp13
       public static final int  JK_AJP13_BAD_HEADER        = -100;
  @@ -118,7 +119,8 @@
       public static final byte JK_AJP13_SEND_BODY_CHUNK   = 3;
       public static final byte JK_AJP13_SEND_HEADERS      = 4;
       public static final byte JK_AJP13_END_RESPONSE      = 5;
  -    public static final byte JK_AJP13_GET_BODY_CHUNK    = 6;
  +     public static final byte JK_AJP13_GET_BODY_CHUNK    = 6;
  +     public static final byte JK_AJP13_PONG_REPLY               = 9;
       
       // Integer codes for common response header strings
       public static final int SC_RESP_CONTENT_TYPE        = 0xA001;
  @@ -300,10 +302,38 @@
                   secret=hBuf.getString();
               }
            return -2;
  +
  +     case JK_AJP13_PING_REQUEST:
  +             return sendPong();
        }
  +     
        return 200; // XXX This is actually an error condition 
  +
       }
   
  +     /**
  +      * Send a PONG REPLY to web server to its PING request
  +      * 
  +      * @param ch the Ajp13 channel
  +      * @param outBuf the Ajp13Packet output packet to use
  +      */
  +     private int sendPong()
  +     {
  +             outBuf.reset();
  +             outBuf.appendByte(JK_AJP13_PONG_REPLY);
  +             
  +             try
  +             {
  +                     send(outBuf);
  +             }
  +             catch (IOException ioe)
  +             {
  +                     d("can't send pong reply");
  +             }
  +             
  +             return (999);   // success but no need to process farther
  +     }
  +     
       /**
        * Parse a FORWARD_REQUEST packet from the web server and store its
        * properties in the passed-in request object.
  
  
  

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

Reply via email to