mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

ludovicp
29.35.2010 7c30dbb5403772b323df3ad907d9ed15d23b5aee
opends/src/server/org/opends/server/replication/server/ReplicationServerHandler.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 */
package org.opends.server.replication.server;
@@ -104,13 +104,6 @@
      }
      oldGenerationId = -100;
      // Duplicate server ?
      if (!replicationServerDomain.checkForDuplicateRS(this))
      {
        abortStart(null);
        return false;
      }
    }
    catch(Exception e)
    {
@@ -179,10 +172,8 @@
  public void connect(String serviceId, boolean sslEncryption)
  throws DirectoryException
  {
    //
    // the encryption we will request to the peer as we are the session creator
    this.initSslEncryption = sslEncryption;
    // we are the initiator and decides of the encryption
    this.sslEncryption = sslEncryption;
    setServiceIdAndDomain(serviceId, false);
@@ -194,9 +185,6 @@
      //
      lockDomain(false); // no timeout
      // we are the initiator and decides of the encryption
      boolean sessionInitiatorSSLEncryption = this.initSslEncryption;
      // Send start
      ReplServerStartMsg outReplServerStartMsg =
        sendStartToRemote(ProtocolVersion.getCurrentVersion());
@@ -217,12 +205,19 @@
      // Process hello from remote
      processStartFromRemote((ReplServerStartMsg)msg);
      // Duplicate server ?
      if (!replicationServerDomain.checkForDuplicateRS(this))
      {
        abortStart(null);
        return;
      }
      // Log
      logStartHandshakeSNDandRCV(outReplServerStartMsg,(ReplServerStartMsg)msg);
      // Until here session is encrypted then it depends on the negociation
      // The session initiator decides whether to use SSL.
      if (!sessionInitiatorSSLEncryption)
      if (!this.sslEncryption)
        session.stopEncryption();
      if (protocolVersion > ProtocolVersion.REPLICATION_PROTOCOL_V1)
@@ -286,13 +281,19 @@
    oldGenerationId = -100;
    try
    {
      // Process start from remote
      boolean sessionInitiatorSSLEncryption =
        processStartFromRemote(inReplServerStartMsg);
      // The initiator decides if the session is encrypted
      sslEncryption = processStartFromRemote(inReplServerStartMsg);
      // lock with timeout
      lockDomain(true);
      // Duplicate server ?
      if (!replicationServerDomain.checkForDuplicateRS(this))
      {
        abortStart(null);
        return;
      }
      this.localGenerationId = replicationServerDomain.getGenerationId();
      ReplServerStartMsg outReplServerStartMsg =
        sendStartToRemote(protocolVersion);
@@ -302,7 +303,7 @@
      // until here session is encrypted then it depends on the negotiation
      // The session initiator decides whether to use SSL.
      if (!sessionInitiatorSSLEncryption)
      if (!sslEncryption)
        session.stopEncryption();
      TopologyMsg inTopoMsg = null;