Commit a7381d6f authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Refactoring of NoSuchRouteException. JM-476

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@3137 b35dd754-fafc-0310-a699-88a17e54d16e
parent f10b96ca
...@@ -46,12 +46,13 @@ public class SocketPacketWriteHandler implements ChannelHandler { ...@@ -46,12 +46,13 @@ public class SocketPacketWriteHandler implements ChannelHandler {
JID recipient = packet.getTo(); JID recipient = packet.getTo();
// Check if the target domain belongs to a remote server or a component // Check if the target domain belongs to a remote server or a component
if (server.matchesComponent(recipient) || server.isRemote(recipient)) { if (server.matchesComponent(recipient) || server.isRemote(recipient)) {
try {
// Locate the route to the remote server or component and ask it // Locate the route to the remote server or component and ask it
// to process the packet // to process the packet
routingTable.getRoute(recipient).process(packet); ChannelHandler route = routingTable.getRoute(recipient);
if (route != null) {
route.process(packet);
} }
catch (NoSuchRouteException e) { else {
// No root was found so either drop or store the packet // No root was found so either drop or store the packet
handleUnprocessedPacket(packet); handleUnprocessedPacket(packet);
} }
......
...@@ -556,20 +556,14 @@ public abstract class SocketReader implements Runnable { ...@@ -556,20 +556,14 @@ public abstract class SocketReader implements Runnable {
return false; return false;
} }
// Check if the host matches a subdomain of this host // Check if the host matches a subdomain of this host
RoutableChannelHandler route = null; RoutableChannelHandler route = routingTable.getRoute(new JID(host));
try { if (route == null || route instanceof OutgoingSessionPromise) {
route = routingTable.getRoute(new JID(host));
if (route instanceof OutgoingSessionPromise) {
return true; return true;
} }
else { else {
return false; return false;
} }
} }
catch (NoSuchRouteException e) {
return true;
}
}
/** /**
* Tries to secure the connection using TLS. If the connection is secured then reset * Tries to secure the connection using TLS. If the connection is secured then reset
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment