Commit 3219a58b authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Fixed logic when adding new routes.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@964 b35dd754-fafc-0310-a699-88a17e54d16e
parent 55614138
...@@ -52,19 +52,25 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable { ...@@ -52,19 +52,25 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable {
routeLock.writeLock().lock(); routeLock.writeLock().lock();
try { try {
if (routes.isEmpty() || destination instanceof InternalComponentManager.RoutableComponent) { if (destination instanceof InternalComponentManager.RoutableComponent) {
routes.put(node.getDomain(), destination); routes.put(node.getDomain(), destination);
} }
else { else {
Object nameRoutes = routes.get(node.getDomain()); Object nameRoutes = routes.get(node.getDomain());
if (nameRoutes == null || nameRoutes instanceof ChannelHandler) { if (nameRoutes == null) {
nameRoutes = new Hashtable(); routes.put(node.getDomain(), destination);
routes.put(node.getDomain(), nameRoutes);
} }
if (((Hashtable)nameRoutes).isEmpty()) { else if (nameRoutes instanceof Hashtable && ((Hashtable)nameRoutes).isEmpty()) {
((Hashtable)nameRoutes).put(nodeJID, destination); ((Hashtable)nameRoutes).put(nodeJID, destination);
} }
else { else {
if (nameRoutes instanceof ChannelHandler) {
nameRoutes = new Hashtable();
Object item = routes.put(node.getDomain(), nameRoutes);
// Associate the previous Route withno the bare JID
((Hashtable)nameRoutes).put("", item);
}
Object resourceRoutes = ((Hashtable)nameRoutes).get(nodeJID); Object resourceRoutes = ((Hashtable)nameRoutes).get(nodeJID);
if (resourceRoutes == null || resourceRoutes instanceof ChannelHandler) { if (resourceRoutes == null || resourceRoutes instanceof ChannelHandler) {
resourceRoutes = new Hashtable(); resourceRoutes = new Hashtable();
......
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