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

Chris Ridd
15.28.2012 cf18feba1c763d9b94354879db456c18514fff44
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -161,7 +161,12 @@
    public int read(ByteBuffer byteBuffer) throws IOException
    {
      return clientChannel.read(byteBuffer);
      int bytesRead = clientChannel.read(byteBuffer);
      if (bytesRead > 0 && keepStats)
      {
        statTracker.updateBytesRead(bytesRead);
      }
      return bytesRead;
    }
    public boolean isOpen()
@@ -182,7 +187,11 @@
      try
      {
        int bytesToWrite = byteBuffer.remaining();
        clientChannel.write(byteBuffer);
        int bytesWritten = clientChannel.write(byteBuffer);
        if (bytesWritten > 0 && keepStats)
        {
          statTracker.updateBytesWritten(bytesWritten);
        }
        if (!byteBuffer.hasRemaining())
        {
          return bytesToWrite;
@@ -208,11 +217,16 @@
          while (byteBuffer.hasRemaining()
              && (System.currentTimeMillis() < stopTime))
          {
            if (clientChannel.write(byteBuffer) < 0)
            bytesWritten = clientChannel.write(byteBuffer);
            if (bytesWritten < 0)
            {
              // The client connection has been closed.
              throw new ClosedChannelException();
            }
            if (bytesWritten > 0 && keepStats)
            {
              statTracker.updateBytesWritten(bytesWritten);
            }
          }
          if (byteBuffer.hasRemaining())
@@ -250,12 +264,16 @@
              SelectionKey k = iterator.next();
              if (k.isWritable())
              {
                int bytesWritten = clientChannel.write(byteBuffer);
                bytesWritten = clientChannel.write(byteBuffer);
                if (bytesWritten < 0)
                {
                  // The client connection has been closed.
                  throw new ClosedChannelException();
                }
                if (bytesWritten > 0 && keepStats)
                {
                  statTracker.updateBytesWritten(bytesWritten);
                }
                iterator.remove();
              }
@@ -960,9 +978,7 @@
      if (keepStats)
      {
        // TODO hard-coded for now, flush probably needs to
        // return how many bytes were flushed.
        statTracker.updateMessageWritten(message, 4096);
        statTracker.updateMessageWritten(message);
      }
    }
    catch (Exception e)