From a5c5efbf8ca56c059709953f7fedb647dadaed06 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Thu, 27 May 2010 15:28:09 +0000
Subject: [PATCH] Fix for issues #3395 and #3998. The changes improves the replica initialization protocol, especially flow control and handling connection outage.

---
 opends/src/server/org/opends/server/replication/common/DSInfo.java |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/common/DSInfo.java b/opends/src/server/org/opends/server/replication/common/DSInfo.java
index fe55063..636eb8b 100644
--- a/opends/src/server/org/opends/server/replication/common/DSInfo.java
+++ b/opends/src/server/org/opends/server/replication/common/DSInfo.java
@@ -58,6 +58,8 @@
   private List<String> refUrls = new ArrayList<String>(0);
   // Group id
   private byte groupId = (byte) -1;
+  // Protocol version
+  private short protocolVersion = -1;
 
   private Set<String> eclIncludes = new HashSet<String>();
 
@@ -74,10 +76,12 @@
    * @param groupId DS group id
    * @param refUrls DS exported referrals URLs
    * @param eclIncludes The list of entry attributes to include in the ECL.
+   * @param protocolVersion Protocol version supported by this server.
    */
   public DSInfo(int dsId, int rsId, long generationId, ServerStatus status,
     boolean assuredFlag, AssuredMode assuredMode, byte safeDataLevel,
-    byte groupId, List<String> refUrls, Set<String> eclIncludes)
+    byte groupId, List<String> refUrls, Set<String> eclIncludes,
+    short protocolVersion)
   {
 
     this.dsId = dsId;
@@ -90,6 +94,7 @@
     this.groupId = groupId;
     this.refUrls = refUrls;
     this.eclIncludes = eclIncludes;
+    this.protocolVersion = protocolVersion;
   }
 
   /**
@@ -175,7 +180,7 @@
 
   /**
    * Get the entry attributes to be included in the ECL.
-   * @return a.
+   * @return The entry attributes to be included in the ECL.
    */
   public Set<String> getEclIncludes()
   {
@@ -183,6 +188,16 @@
   }
 
   /**
+   * Get the protocol version supported by this server.
+   * Returns -1 when the protocol version is not known (too old version).
+   * @return The protocol version.
+   */
+  public short getProtocolVersion()
+  {
+    return protocolVersion;
+  }
+
+  /**
    * Test if the passed object is equal to this one.
    * @param obj The object to test
    * @return True if both objects are equal
@@ -205,6 +220,7 @@
         (assuredMode == dsInfo.getAssuredMode()) &&
         (safeDataLevel == dsInfo.getSafeDataLevel()) &&
         (groupId == dsInfo.getGroupId()) &&
+        (protocolVersion == dsInfo.getProtocolVersion()) &&
         (refUrls.equals(dsInfo.getRefUrls())) &&
          (((eclIncludes == null) && (dsInfo.getEclIncludes() == null)) ||
            ((eclIncludes != null) &&
@@ -234,6 +250,7 @@
     hash = 73 * hash + (this.refUrls != null ? this.refUrls.hashCode() : 0);
     hash = 73 * hash + (this.eclIncludes != null ? eclIncludes.hashCode() : 0);
     hash = 73 * hash + this.groupId;
+    hash = 73 * hash + this.protocolVersion;
     return hash;
   }
 
@@ -261,6 +278,8 @@
     sb.append(safeDataLevel);
     sb.append(" ; Group id: ");
     sb.append(groupId);
+    sb.append(" ; Protocol version: ");
+    sb.append(protocolVersion);
     sb.append(" ; Referral URLs: ");
     sb.append(refUrls);
     sb.append(" ; ECL Include: ");

--
Gitblit v1.10.0