You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by David Jencks <da...@yahoo.com> on 2009/02/06 19:36:04 UTC
What is this code trying to do???
I'd like to apply the patch for AMQ-2094
Index: src/main/java/org/apache/activemq/transport/tcp/
TcpTransportServer.java
===================================================================
--- src/main/java/org/apache/activemq/transport/tcp/
TcpTransportServer.java (revision 740246)
+++ src/main/java/org/apache/activemq/transport/tcp/
TcpTransportServer.java (working copy)
@@ -130,11 +130,8 @@
InetAddress addr = InetAddress.getByName(host);
try {
- if (host.trim().equals("localhost") ||
addr.equals(InetAddress.getLocalHost())) {
- this.serverSocket =
serverSocketFactory.createServerSocket(bind.getPort(), backlog);
- } else {
- this.serverSocket =
serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);
- }
+
+ this.serverSocket =
serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);
configureServerSocket(this.serverSocket);
because as noted in the comment to the issue if host is the actual ip
address then addr.equals(InetAddress.getLocalHost()) is always true.
However I wonder if there is some purpose to the existing code that
should be implemented properly?
If no one speaks up in a bit I'm going to go ahead and apply the patch.
thanks
david jencks
Re: What is this code trying to do???
Posted by Hiram Chirino <ch...@gmail.com>.
Idea is this:
Usually when users bind tcp://localhsot:61616 for a server port they
usually want to bind to all interfaces not just 127.0.0.1.
And I THINK you can argue the same case when the user replaces
'localhost' with the hostname of the machine.
IMHO the only time a user is requesting to bind to specific interface
is when he explicity provides and IP address. Like:
tcp://127.0.0.1:61616, should only bind to the 127.0.0.1 interface.
Regards,
Hiram
On Fri, Feb 6, 2009 at 1:36 PM, David Jencks <da...@yahoo.com> wrote:
> I'd like to apply the patch for AMQ-2094
>
> Index:
> src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
> ===================================================================
> --- src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
> (revision 740246)
> +++ src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
> (working copy)
> @@ -130,11 +130,8 @@
> InetAddress addr = InetAddress.getByName(host);
>
> try {
> - if (host.trim().equals("localhost") ||
> addr.equals(InetAddress.getLocalHost())) {
> - this.serverSocket =
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);
> - } else {
> - this.serverSocket =
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);
> - }
> +
> + this.serverSocket =
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);
> configureServerSocket(this.serverSocket);
>
> because as noted in the comment to the issue if host is the actual ip
> address then addr.equals(InetAddress.getLocalHost()) is always true.
>
> However I wonder if there is some purpose to the existing code that should
> be implemented properly?
>
> If no one speaks up in a bit I'm going to go ahead and apply the patch.
>
> thanks
> david jencks
>
>
--
Regards,
Hiram
Blog: http://hiramchirino.com
Open Source SOA
http://open.iona.com