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 ChannelHandler route = routingTable.getRoute(recipient);
routingTable.getRoute(recipient).process(packet); 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,19 +556,13 @@ public abstract class SocketReader implements Runnable { ...@@ -556,19 +556,13 @@ 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;
}
else {
return false;
}
}
catch (NoSuchRouteException e) {
return true; return true;
} }
else {
return false;
}
} }
/** /**
......
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