From 63f1d8aa27cd58a798acc351e69fa36d9ef810b6 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Fri, 04 May 2007 16:13:32 +0000
Subject: [PATCH] Fixes for the 2 replication problems :
---
opends/src/server/org/opends/server/replication/server/ReplicationServer.java | 29 ++++++++++++++++++++++++-----
1 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
index 3c27378..3441a68 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -103,6 +103,7 @@
private int queueSize;
private String dbDirname = null;
private long trimAge; // the time (in sec) after which the changes must
+ private int replicationPort;
// de deleted from the persistent storage.
/**
@@ -116,7 +117,7 @@
{
shutdown = false;
runListen = true;
- int replicationPort = configuration.getReplicationPort();
+ replicationPort = configuration.getReplicationPort();
replicationServerId = (short) configuration.getReplicationServerId();
replicationServers = configuration.getReplicationServer();
if (replicationServers == null)
@@ -254,10 +255,29 @@
*/
for (String serverURL : replicationServers)
{
- if ((serverURL.compareTo(this.serverURL) != 0) &&
- (!connectedReplServers.contains(serverURL)))
+ String token[] = serverURL.split(":");
+ String hostname = token[0];
+ String port = token[1];
+
+ try
{
- this.connect(serverURL, replicationCache.getBaseDn());
+ InetAddress inetAddress = InetAddress.getByName(hostname);
+ String serverAddress = inetAddress.getHostAddress() + ":" + port;
+
+ if ((serverAddress.compareTo("127.0.0.1:" + replicationPort) != 0)
+ && (serverAddress.compareTo(this.localURL) != 0)
+ && (!connectedReplServers.contains(serverAddress)))
+ {
+ this.connect(serverURL, replicationCache.getBaseDn());
+ }
+ }
+ catch (IOException e)
+ {
+ int msgID = MSGID_COULD_NOT_SOLVE_HOSTNAME;
+ String message = getMessage(msgID, hostname);
+ logError(ErrorLogCategory.SYNCHRONIZATION,
+ ErrorLogSeverity.SEVERE_ERROR,
+ message, msgID);
}
}
}
@@ -510,7 +530,6 @@
public boolean isConfigurationChangeAcceptable(
ReplicationServerCfg configuration, List<String> unacceptableReasons)
{
- // TODO : implement this
return true;
}
}
--
Gitblit v1.10.0