You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2008/02/20 17:51:55 UTC
svn commit: r629532 -
/httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java
Author: olegk
Date: Wed Feb 20 08:51:54 2008
New Revision: 629532
URL: http://svn.apache.org/viewvc?rev=629532&view=rev
Log:
HTTPCORE-148: cleaned up connection state reset code
Modified:
httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java
Modified: httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java?rev=629532&r1=629531&r2=629532&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java (original)
+++ httpcomponents/httpcore/branches/limewire_contrib/module-nio/src/main/java/org/apache/http/nio/protocol/AsyncNHttpServiceHandler.java Wed Feb 20 08:51:54 2008
@@ -48,7 +48,6 @@
import org.apache.http.UnsupportedHttpVersionException;
import org.apache.http.nio.ContentDecoder;
import org.apache.http.nio.ContentEncoder;
-import org.apache.http.nio.NHttpConnection;
import org.apache.http.nio.NHttpServerConnection;
import org.apache.http.nio.NHttpServiceHandler;
import org.apache.http.nio.entity.ConsumingNHttpEntity;
@@ -141,6 +140,7 @@
HttpContext context = conn.getContext();
ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STATE);
+ connState.reset();
HttpRequest request = conn.getHttpRequest();
request.setParams(new DefaultedHttpParams(request.getParams(), this.params));
@@ -230,7 +230,7 @@
HttpContext context = conn.getContext();
ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STATE);
- connState.finish();
+ connState.reset();
if (this.eventListener != null) {
this.eventListener.connectionClosed(conn);
@@ -331,24 +331,6 @@
}
}
- @Override
- protected void closeConnection(final NHttpConnection conn, final Throwable cause) {
- HttpContext context = conn.getContext();
- ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STATE);
- connState.finish();
-
- super.closeConnection(conn, cause);
- }
-
- @Override
- protected void shutdownConnection(NHttpConnection conn, Throwable cause) {
- HttpContext context = conn.getContext();
- ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STATE);
- connState.finish();
-
- super.shutdownConnection(conn, cause);
- }
-
private void handleException(final HttpException ex, final HttpResponse response) {
int code = HttpStatus.SC_INTERNAL_SERVER_ERROR;
if (ex instanceof MethodNotSupportedException) {
@@ -467,9 +449,10 @@
}
}
- void finish() {
+ void reset() {
finishInput();
finishOutput();
+ this.requestHandler = null;
}
public NHttpRequestHandler getRequestHandler() {