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

davidely
20.43.2007 42183c9f7ddb823d7e0e4c4308a4b0d54b1a3e7e
Fix for 1249.  Set SO_LINGER and REUSE_ADDR in LDAPConnection used by command line tools such as LDAPSearch
1 files modified
15 ■■■■■ changed files
opends/src/server/org/opends/server/tools/LDAPConnection.java 15 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/LDAPConnection.java
@@ -22,11 +22,12 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006 Sun Microsystems, Inc.
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.tools;
import java.io.PrintStream;
import java.io.IOException;
import java.net.ConnectException;
import java.net.Socket;
import java.net.UnknownHostException;
@@ -245,6 +246,18 @@
      throw new LDAPConnectionException(ex2.getMessage(), ex2);
    }
    // We need this so that we don't run out of addresses when the tool
    // commands are called A LOT, as in the unit tests.
    try
    {
      socket.setSoLinger(true, 0);
      socket.setReuseAddress(true);
    } catch(IOException e)
    {
      assert debugException(CLASS_NAME, "connectToHost", e);
      // It doesn't matter too much if this throws, so ignore it.
    }
    if (connectionOptions.getReportAuthzID())
    {
      requestControls.add(new LDAPControl(OID_AUTHZID_REQUEST));