Commit 029864b6 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Return an OutgoingSessionPromise if a connection to a remote server does not exist. JM-416

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@2889 b35dd754-fafc-0310-a699-88a17e54d16e
parent 210646fa
...@@ -13,15 +13,15 @@ package org.jivesoftware.messenger.spi; ...@@ -13,15 +13,15 @@ package org.jivesoftware.messenger.spi;
import org.jivesoftware.messenger.*; import org.jivesoftware.messenger.*;
import org.jivesoftware.messenger.component.InternalComponentManager; import org.jivesoftware.messenger.component.InternalComponentManager;
import org.jivesoftware.messenger.server.OutgoingServerSession;
import org.jivesoftware.messenger.container.BasicModule; import org.jivesoftware.messenger.container.BasicModule;
import org.jivesoftware.messenger.server.OutgoingSessionPromise;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* <p>Uses simple hashtables for table storage.</p> * <p>Uses simple hashtables for table storage.</p>
...@@ -87,9 +87,9 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable { ...@@ -87,9 +87,9 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable {
// Check if the address belongs to a remote server // Check if the address belongs to a remote server
if (!serverName.equals(node.getDomain()) && routes.get(node.getDomain()) == null && if (!serverName.equals(node.getDomain()) && routes.get(node.getDomain()) == null &&
componentManager.getComponent(node.getDomain()) == null) { componentManager.getComponent(node.getDomain()) == null) {
// Authenticate this hostname with the remote server so that the remote server can // Return a promise of a remote session. This object will queue packets pending
// accept packets from this server. // to be sent to remote servers
OutgoingServerSession.authenticateDomain(serverName, node.getDomain()); return OutgoingSessionPromise.getInstance();
} }
routeLock.readLock().lock(); routeLock.readLock().lock();
...@@ -128,9 +128,9 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable { ...@@ -128,9 +128,9 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable {
// Check if the address belongs to a remote server // Check if the address belongs to a remote server
if (!serverName.equals(node.getDomain()) && routes.get(node.getDomain()) == null && if (!serverName.equals(node.getDomain()) && routes.get(node.getDomain()) == null &&
componentManager.getComponent(node.getDomain()) == null) { componentManager.getComponent(node.getDomain()) == null) {
// Authenticate this hostname with the remote server so that the remote server can // Return a promise of a remote session. This object will queue packets pending
// accept packets from this server. // to be sent to remote servers
OutgoingServerSession.authenticateDomain(serverName, node.getDomain()); return Arrays.asList(OutgoingSessionPromise.getInstance()).iterator();
} }
LinkedList list = null; LinkedList list = null;
......
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