tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 33474] New: - tcpListenPort="0" won't get actual local port for cluster membership
Date Wed, 09 Feb 2005 20:24:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33474>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33474

           Summary: tcpListenPort="0" won't get actual local port for
                    cluster membership
           Product: Tomcat 5
           Version: 5.5.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Catalina:Cluster
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: cstach-asf@ldsys.net


Binding to port 0 is perfectly valid.  Any port will do, and in my case, 
managing a list of over 1000 vhosts' ports is not acceptable.  Some configured 
ports may or may not be available.  It shouldn't matter what port is used for 
the listener in most cases.  The current code returns the port that is 
configured in the server.xml.  If that port is 0, 0 will be sent to the 
MembershipService.  Obviously, that's not going to work.  If we configure port 
0, get the local port that we actually bound to.

Index: ReplicationListener.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-
catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationLi
stener.java,v
retrieving revision 1.18
diff -u -r1.18 ReplicationListener.java
--- ReplicationListener.java	27 Dec 2004 09:30:36 -0000	1.18
+++ ReplicationListener.java	9 Feb 2005 20:13:51 -0000
@@ -101,6 +101,9 @@
         selector = Selector.open();
         // set the port the server channel will listen to
         serverSocket.bind (new InetSocketAddress (bind,tcpListenPort));
+        if (tcpListenPort == 0) {
+        	tcpListenPort = serverSocket.getLocalPort();
+        }
         // set non-blocking mode for the listening socket
         serverChannel.configureBlocking (false);
         // register the ServerSocketChannel with the Selector

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
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