On Mon, Apr 30, 2001 at 05:15:46PM -0500, Marc Saegesser wrote:
> Tomcat 3.2.2 beta 4 is available for download.  If you can provide binaries
> for various please send them to me or update the FTP site.  Thanks.

Hi, all!
I've made a little modification in Tomcat 3.2.1 codebase that I think would
be nice to include in TC 3.2.2.

Problem: shutdown script always connects to "localhost" to send shutdown command.
It is a problem on a "multihomed" machine running multiple tomcats where
tomcats use same port numbers but bound to different IP adresses using inet=""
configuration option in server.xml.

Fix: query PoolTcpConnector.INET attribute in shutdown code.

Attached please find a little patch file. This is patch against my repository
and TC 3.2.1 but I checked the very same file
(src/share/org/apache/tomcat/task/StopTomcat.java) in TC 3.2.2 beta 4 and it
was identical to the old one, so I beleive the patch would be the same.


Thanks.

-- 
oo Andrey
oo
oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOo
"All mail clients suck. This one just sucks less."
           -- http://www.mutt.org/  Jeremy Blosser
oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOo
Index: jakarta-tomcat/src/share/org/apache/tomcat/task/StopTomcat.java
diff -c jakarta-tomcat/src/share/org/apache/tomcat/task/StopTomcat.java:1.1 
jakarta-tomcat/src/share/org/apache/tomcat/task/StopTomcat.java:1.3
*** jakarta-tomcat/src/share/org/apache/tomcat/task/StopTomcat.java:1.1 Sat Mar 24 
20:19:05 2001
--- jakarta-tomcat/src/share/org/apache/tomcat/task/StopTomcat.java     Tue May  1 
18:23:55 2001
***************
*** 87,92 ****
--- 87,94 ----
      {
        // Find Ajp12 connector
        int portInt=8007;
+       InetAddress addr = null;
+ 
        Enumeration enum=cm.getConnectors();
        while( enum.hasMoreElements() ) {
            Object con=enum.nextElement();
***************
*** 95,107 ****
                if( tcpCon.getTcpConnectionHandler()
                    instanceof Ajp12ConnectionHandler ) {
                    portInt=tcpCon.getPort();
                }
            }
        }
  
        // use Ajp12 to stop the server...
        try {
!           Socket socket = new Socket("localhost", portInt);
            OutputStream os=socket.getOutputStream();
            byte stopMessage[]=new byte[2];
            stopMessage[0]=(byte)254;
--- 97,111 ----
                if( tcpCon.getTcpConnectionHandler()
                    instanceof Ajp12ConnectionHandler ) {
                    portInt=tcpCon.getPort();
+                   addr = (InetAddress)tcpCon.getAttribute(PoolTcpConnector.INET);
                }
            }
        }
  
        // use Ajp12 to stop the server...
        try {
!           if(null == addr) addr =  InetAddress.getLocalHost();
!           Socket socket = new Socket(addr, portInt);
            OutputStream os=socket.getOutputStream();
            byte stopMessage[]=new byte[2];
            stopMessage[0]=(byte)254;

Reply via email to