Commit 65a31a79 authored by Dave Cridland's avatar Dave Cridland

Fix odd logic around new server sessions

Double-check removed, streamlining logic.
parent 877c20eb
...@@ -118,7 +118,7 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou ...@@ -118,7 +118,7 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
* @param hostname the hostname of the remote server. * @param hostname the hostname of the remote server.
* @return True if the domain was authenticated by the remote server. * @return True if the domain was authenticated by the remote server.
*/ */
public static boolean authenticateDomain(String domain, String hostname) { public static boolean authenticateDomain(final String domain, final String hostname) {
if (hostname == null || hostname.length() == 0 || hostname.trim().indexOf(' ') > -1) { if (hostname == null || hostname.length() == 0 || hostname.trim().indexOf(' ') > -1) {
// Do nothing if the target hostname is empty, null or contains whitespaces // Do nothing if the target hostname is empty, null or contains whitespaces
return false; return false;
...@@ -158,9 +158,6 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou ...@@ -158,9 +158,6 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
} }
if (session == null) { if (session == null) {
int port = RemoteServerManager.getPortForServer(hostname); int port = RemoteServerManager.getPortForServer(hostname);
// No session was found to the remote server so make sure that only one is created
session = sessionManager.getOutgoingServerSession(hostname);
if (session == null) {
session = createOutgoingSession(domain, hostname, port); session = createOutgoingSession(domain, hostname, port);
if (session != null) { if (session != null) {
// Add the validated domain as an authenticated domain // Add the validated domain as an authenticated domain
...@@ -170,7 +167,6 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou ...@@ -170,7 +167,6 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
// Notify the SessionManager that a new session has been created // Notify the SessionManager that a new session has been created
sessionManager.outgoingServerSessionCreated((LocalOutgoingServerSession) session); sessionManager.outgoingServerSessionCreated((LocalOutgoingServerSession) session);
return true; return true;
}
} else { } else {
Log.warn("Fail to connect to {} for {}", hostname, domain); Log.warn("Fail to connect to {} for {}", hostname, domain);
return false; 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