From 04e870d40ff37a78f8c89c0a91c479545bc92d4f Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Thu, 14 Feb 2008 01:49:59 +0000
Subject: [PATCH] - followup to [Issue 2877] : Issue with creation of connection handler:   fix various dynamic re/configuration issues.

---
 opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
index b565302..f66c37c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
@@ -758,26 +758,26 @@
 
     // Attempt to bind to the listen port on all configured addresses to
     // verify whether the connection handler will be able to start.
-    listenPort = config.getListenPort();
-    listenAddresses = config.getListenAddress();
-    allowReuseAddress = config.isAllowTCPReuseAddress();
+    if ((currentConfig == null) ||
+      (!currentConfig.isEnabled() && config.isEnabled())) {
+      for (InetAddress a : config.getListenAddress()) {
+        try {
+          if (StaticUtils.isAddressInUse(a, config.getListenPort(),
+            config.isAllowTCPReuseAddress())) {
+            throw new IOException(
+              ERR_CONNHANDLER_ADDRESS_INUSE.get().toString());
+          }
+        } catch (IOException e) {
+          if (debugEnabled()) {
+            TRACER.debugCaught(DebugLogLevel.ERROR, e);
+          }
 
-    for (InetAddress a : listenAddresses) {
-      try {
-        if (StaticUtils.isAddressInUse(a, listenPort, allowReuseAddress)) {
-          throw new IOException(
-            ERR_CONNHANDLER_ADDRESS_INUSE.get().toString());
+          Message message = ERR_LDAP_CONNHANDLER_CANNOT_BIND.get(
+            String.valueOf(config.dn()), a.getHostAddress(),
+            config.getListenPort(), getExceptionMessage(e));
+          unacceptableReasons.add(message);
+          return false;
         }
-      } catch (IOException e) {
-        if (debugEnabled()) {
-          TRACER.debugCaught(DebugLogLevel.ERROR, e);
-        }
-
-        Message message = ERR_LDAP_CONNHANDLER_CANNOT_BIND.get(
-          String.valueOf(config.dn()), a.getHostAddress(),
-          listenPort, getExceptionMessage(e));
-        unacceptableReasons.add(message);
-        return false;
       }
     }
 

--
Gitblit v1.10.0