summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2014-08-26 13:24:34 +0000
committerRobert Godfrey <rgodfrey@apache.org>2014-08-26 13:24:34 +0000
commiteb188ecb147e72b9bbc47f49d1d80fb8ac70f818 (patch)
treeccd5405f38eabe68fefa97192fc0b20e5baf21da /qpid/java/broker-plugins
parent404704e3106d12050853a36476fc333394772e9b (diff)
downloadqpid-python-eb188ecb147e72b9bbc47f49d1d80fb8ac70f818.tar.gz
QPID-6044 : [Java Broker] [AMQP 1.0] cache the valid host names for the local machine
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1620593 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins')
-rw-r--r--qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java58
1 files changed, 1 insertions, 57 deletions
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java
index 8edc097a24..f97a223f4d 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java
@@ -22,19 +22,13 @@ package org.apache.qpid.server.protocol.v1_0;
import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.CONNECTION_FORMAT;
-import java.net.InetAddress;
-import java.net.InterfaceAddress;
-import java.net.NetworkInterface;
import java.net.SocketAddress;
-import java.net.SocketException;
-import java.net.UnknownHostException;
import java.security.Principal;
import java.security.PrivilegedAction;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -142,7 +136,7 @@ public class Connection_1_0 implements ConnectionEventListener, AMQConnectionMod
}
_vhost = ((AmqpPort)_port).getVirtualHost(host);
- if(_vhost == null && isNetworkAddress(host))
+ if(_vhost == null && _port.isLocalMachine(host))
{
_vhost = ((AmqpPort)_port).getVirtualHost(_broker.getDefaultVirtualHost());
}
@@ -163,56 +157,6 @@ public class Connection_1_0 implements ConnectionEventListener, AMQConnectionMod
_subject.getPrivateCredentials().addAll(authSubject.getPrivateCredentials());
}
}
-
- private boolean isNetworkAddress(final String host)
- {
-
- try
- {
- Set<InetAddress> addresses = new HashSet<>();
-
- for(NetworkInterface networkInterface : Collections.list(NetworkInterface.getNetworkInterfaces()))
- {
- for(InterfaceAddress inetAddress : networkInterface.getInterfaceAddresses())
- {
- InetAddress address = inetAddress.getAddress();
- addresses.add(address);
- if(host.equals(address.getHostAddress()))
- {
- return true;
- }
- if(host.equals(address.getHostName()))
- {
- return true;
- }
- if(host.equals(address.getCanonicalHostName()))
- {
- return true;
- }
- }
- }
-
- try
- {
- InetAddress inetAddress = InetAddress.getByName(host);
- if(addresses.contains(inetAddress))
- {
- return true;
- }
- }
- catch (UnknownHostException e)
- {
- // ignore
- }
- }
- catch (SocketException e)
- {
- // ignore
- }
-
- return false;
- }
-
public void remoteSessionCreation(SessionEndpoint endpoint)
{
if(!_closedOnOpen)