From 74023634617762408423a44c8dd01ee050fef584 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 03 Jun 2013 09:13:08 +0000
Subject: [PATCH] Fix OPENDJ-866 Local RS is named differently to remote RS under cn=replication,cn=monitor

---
 opends/src/server/org/opends/server/replication/service/ReplicationBroker.java |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java b/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
index 3307e31..987998f 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
@@ -1239,17 +1239,19 @@
           .isSslEncryption(server);
 
       // Send our ServerStartMsg.
+      String url = socket.getLocalAddress().getHostName() + ":"
+          + socket.getLocalPort();
       StartMsg serverStartMsg;
       if (!isECL)
       {
-        serverStartMsg = new ServerStartMsg(serverId, baseDn,
+        serverStartMsg = new ServerStartMsg(serverId, url, baseDn,
             maxRcvWindow, heartbeatInterval, state,
             ProtocolVersion.getCurrentVersion(),
             this.getGenerationID(), isSslEncryption, groupId);
       }
       else
       {
-        serverStartMsg = new ServerStartECLMsg(0, 0, 0, 0,
+        serverStartMsg = new ServerStartECLMsg(url, 0, 0, 0, 0,
             maxRcvWindow, heartbeatInterval, state,
             ProtocolVersion.getCurrentVersion(),
             this.getGenerationID(), isSslEncryption, groupId);
@@ -3117,4 +3119,16 @@
     return shutdown;
   }
 
+  /**
+   * Returns the local address of this replication domain, or the empty string
+   * if it is not yet connected.
+   *
+   * @return The local address.
+   */
+  String getLocalUrl()
+  {
+    final ProtocolSession tmp = session;
+    return tmp != null ? tmp.getLocalUrl() : "";
+  }
+
 }

--
Gitblit v1.10.0