| | |
| | | // fall back to a more inefficient way that will work without a |
| | | // selector. |
| | | while (byteBuffer.hasRemaining() |
| | | && (System.currentTimeMillis() < stopTime)) |
| | | && System.currentTimeMillis() < stopTime) |
| | | { |
| | | bytesWritten = clientChannel.write(byteBuffer); |
| | | if (bytesWritten < 0) |
| | |
| | | } |
| | | |
| | | List<String> opReferrals = operation.getReferralURLs(); |
| | | if ((opReferrals != null) && (!opReferrals.isEmpty())) |
| | | if (opReferrals != null && !opReferrals.isEmpty()) |
| | | { |
| | | StringBuilder referralsStr = new StringBuilder(); |
| | | Iterator<String> iterator = opReferrals.iterator(); |
| | |
| | | |
| | | // See if we should send a notification to the client. If so, then |
| | | // construct and send a notice of disconnection unsolicited |
| | | // response. Note that we cannot send this notification to an LDAPv2 |
| | | // client. |
| | | if (sendNotification && (ldapVersion != 2)) |
| | | // response. Note that we cannot send this notification to an LDAPv2 client. |
| | | if (sendNotification && ldapVersion != 2) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | if (asn1Reader.hasRemainingData() || (e instanceof SSLException)) |
| | | if (asn1Reader.hasRemainingData() || e instanceof SSLException) |
| | | { |
| | | // The connection failed, but there was an unread partial message so |
| | | // interpret this as an IO error. |
| | |
| | | * connection has been closed as a result (it is the |
| | | * responsibility of this method to close the connection). |
| | | */ |
| | | private boolean processAbandonRequest(LDAPMessage message, |
| | | List<Control> controls) |
| | | private boolean processAbandonRequest(LDAPMessage message, List<Control> controls) |
| | | { |
| | | if ((ldapVersion == 2) && (controls != null) |
| | | && (!controls.isEmpty())) |
| | | if (ldapVersion == 2 && controls != null && !controls.isEmpty()) |
| | | { |
| | | // LDAPv2 clients aren't allowed to send controls. |
| | | disconnect(DisconnectReason.PROTOCOL_ERROR, false, |
| | |
| | | * connection has been closed as a result (it is the |
| | | * responsibility of this method to close the connection). |
| | | */ |
| | | private boolean processAddRequest(LDAPMessage message, |
| | | List<Control> controls) |
| | | private boolean processAddRequest(LDAPMessage message, List<Control> controls) |
| | | { |
| | | if ((ldapVersion == 2) && (controls != null) |
| | | && (!controls.isEmpty())) |
| | | if (ldapVersion == 2 && controls != null && !controls.isEmpty()) |
| | | { |
| | | // LDAPv2 clients aren't allowed to send controls. |
| | | AddResponseProtocolOp responseOp = |
| | |
| | | return false; |
| | | } |
| | | |
| | | if ((controls != null) && (!controls.isEmpty())) |
| | | if (controls != null && !controls.isEmpty()) |
| | | { |
| | | // LDAPv2 clients aren't allowed to send controls. |
| | | BindResponseProtocolOp responseOp = |
| | |
| | | * connection has been closed as a result (it is the |
| | | * responsibility of this method to close the connection). |
| | | */ |
| | | private boolean processCompareRequest(LDAPMessage message, |
| | | List<Control> controls) |
| | | private boolean processCompareRequest(LDAPMessage message, List<Control> controls) |
| | | { |
| | | if ((ldapVersion == 2) && (controls != null) |
| | | && (!controls.isEmpty())) |
| | | if (ldapVersion == 2 && controls != null && !controls.isEmpty()) |
| | | { |
| | | // LDAPv2 clients aren't allowed to send controls. |
| | | CompareResponseProtocolOp responseOp = |
| | |
| | | * connection has been closed as a result (it is the |
| | | * responsibility of this method to close the connection). |
| | | */ |
| | | private boolean processDeleteRequest(LDAPMessage message, |
| | | List<Control> controls) |
| | | private boolean processDeleteRequest(LDAPMessage message, List<Control> controls) |
| | | { |
| | | if ((ldapVersion == 2) && (controls != null) |
| | | && (!controls.isEmpty())) |
| | | if (ldapVersion == 2 && controls != null && !controls.isEmpty()) |
| | | { |
| | | // LDAPv2 clients aren't allowed to send controls. |
| | | DeleteResponseProtocolOp responseOp = |
| | |
| | | * connection has been closed as a result (it is the |
| | | * responsibility of this method to close the connection). |
| | | */ |
| | | private boolean processModifyRequest(LDAPMessage message, |
| | | List<Control> controls) |
| | | private boolean processModifyRequest(LDAPMessage message, List<Control> controls) |
| | | { |
| | | if ((ldapVersion == 2) && (controls != null) |
| | | && (!controls.isEmpty())) |
| | | if (ldapVersion == 2 && controls != null && !controls.isEmpty()) |
| | | { |
| | | // LDAPv2 clients aren't allowed to send controls. |
| | | ModifyResponseProtocolOp responseOp = |
| | |
| | | * connection has been closed as a result (it is the |
| | | * responsibility of this method to close the connection). |
| | | */ |
| | | private boolean processModifyDNRequest(LDAPMessage message, |
| | | List<Control> controls) |
| | | private boolean processModifyDNRequest(LDAPMessage message, List<Control> controls) |
| | | { |
| | | if ((ldapVersion == 2) && (controls != null) |
| | | && (!controls.isEmpty())) |
| | | if (ldapVersion == 2 && controls != null && !controls.isEmpty()) |
| | | { |
| | | // LDAPv2 clients aren't allowed to send controls. |
| | | ModifyDNResponseProtocolOp responseOp = |
| | |
| | | private boolean processSearchRequest(LDAPMessage message, |
| | | List<Control> controls) |
| | | { |
| | | if ((ldapVersion == 2) && (controls != null) |
| | | && (!controls.isEmpty())) |
| | | if (ldapVersion == 2 && controls != null && !controls.isEmpty()) |
| | | { |
| | | // LDAPv2 clients aren't allowed to send controls. |
| | | SearchResultDoneProtocolOp responseOp = |
| | |
| | | if (operationsInProgress.isEmpty() |
| | | && getPersistentSearches().isEmpty()) |
| | | { |
| | | return (TimeThread.getTime() - lastCompletionTime.get()); |
| | | return TimeThread.getTime() - lastCompletionTime.get(); |
| | | } |
| | | else |
| | | { |