From 3c685926df93073d5c5088434132a6f3f844ba32 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 06 Oct 2011 14:15:09 +0000
Subject: [PATCH] Fix OPENDJ-306: Misleading access log error message when client resets the connection.
---
opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index c31f5cd..b67cc3a 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -1587,9 +1587,25 @@
{
TRACER.debugCaught(DebugLogLevel.ERROR, e);
}
- Message m =
- ERR_LDAP_CLIENT_DECODE_LDAP_MESSAGE_FAILED.get(String.valueOf(e));
- disconnect(DisconnectReason.PROTOCOL_ERROR, true, m);
+
+ if (asn1Reader.hasRemainingData())
+ {
+ // The connection failed, but there was an unread partial message so
+ // interpret this as an IO error.
+ Message m = ERR_LDAP_CLIENT_IO_ERROR_DURING_READ.get(String
+ .valueOf(e));
+ disconnect(DisconnectReason.IO_ERROR, true, m);
+ }
+ else
+ {
+ // The connection failed and there was no unread data, so interpret this
+ // as indicating that the client aborted (reset) the connection. This
+ // happens when a client configures closes a connection which has been
+ // configured with SO_LINGER set to 0.
+ Message m = ERR_LDAP_CLIENT_IO_ERROR_BEFORE_READ.get();
+ disconnect(DisconnectReason.CLIENT_DISCONNECT, true, m);
+ }
+
return -1;
}
}
--
Gitblit v1.10.0