hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r474721 - in /jakarta/httpcomponents/httpcore/trunk/module-nio/src: examples/org/apache/http/nio/examples/ main/java/org/apache/http/nio/impl/ main/java/org/apache/http/nio/impl/reactor/ main/java/org/apache/http/nio/util/
Date Tue, 14 Nov 2006 10:38:55 GMT
Author: olegk
Date: Tue Nov 14 02:38:54 2006
New Revision: 474721

URL: http://svn.apache.org/viewvc?view=rev&rev=474721
Log:
A number of bug fixes all over

Modified:
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/nio/examples/AsyncHttpServer.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/NHttpConnectionBase.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/IOSessionImpl.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/nio/examples/AsyncHttpServer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/nio/examples/AsyncHttpServer.java?view=diff&rev=474721&r1=474720&r2=474721
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/nio/examples/AsyncHttpServer.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/nio/examples/AsyncHttpServer.java
Tue Nov 14 02:38:54 2006
@@ -57,7 +57,7 @@
         HttpParams params = new DefaultHttpParams(null);
         params
             .setIntParameter(HttpConnectionParams.SO_TIMEOUT, 5000)
-            .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 1024)
+            .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024)
             .setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK, false)
             .setBooleanParameter(HttpConnectionParams.TCP_NODELAY, true)
             .setParameter(HttpProtocolParams.ORIGIN_SERVER, "Jakarta-HttpComponents-NIO/1.1");

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpServerConnection.java?view=diff&rev=474721&r1=474720&r2=474721
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpServerConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpServerConnection.java
Tue Nov 14 02:38:54 2006
@@ -69,6 +69,7 @@
         this.request = null;
         this.contentDecoder = null;
         this.requestParser.reset();
+        this.session.setEvent(EventMask.READ);
     }
     
     private void resetOutput() {

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/NHttpConnectionBase.java?view=diff&rev=474721&r1=474720&r2=474721
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/NHttpConnectionBase.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/NHttpConnectionBase.java
Tue Nov 14 02:38:54 2006
@@ -123,25 +123,25 @@
     }
 
     public void requestInput() {
-        if (this.contentEncoder != null) {
+        if (this.contentDecoder != null) {
             this.session.setEvent(EventMask.READ);
         }
     }
 
     public void requestOutput() {
-        if (this.contentDecoder != null) {
+        if (this.contentEncoder != null) {
             this.session.setEvent(EventMask.WRITE);
         }
     }
 
     public void suspendInput() {
-        if (this.contentEncoder != null) {
+        if (this.contentDecoder != null) {
             this.session.clearEvent(EventMask.READ);
         }
     }
 
     public void suspendOutput() {
-        if (this.contentDecoder != null) {
+        if (this.contentEncoder != null) {
             this.session.clearEvent(EventMask.WRITE);
         }
     }

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/IOSessionImpl.java?view=diff&rev=474721&r1=474720&r2=474721
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/IOSessionImpl.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/IOSessionImpl.java
Tue Nov 14 02:38:54 2006
@@ -89,6 +89,9 @@
     }
     
     public void setEventMask(int ops) {
+        if (this.closed) {
+            return;
+        }
         synchronized (this.key) {
             this.key.interestOps(ops);
             this.key.selector().wakeup();
@@ -96,6 +99,9 @@
     }
     
     public void setEvent(int op) {
+        if (this.closed) {
+            return;
+        }
         synchronized (this.key) {
             int ops = this.key.interestOps();
             this.key.interestOps(ops | op);
@@ -104,6 +110,9 @@
     }
     
     public void clearEvent(int op) {
+        if (this.closed) {
+            return;
+        }
         synchronized (this.key) {
             int ops = this.key.interestOps();
             this.key.interestOps(ops & ~op);

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java?view=diff&rev=474721&r1=474720&r2=474721
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
Tue Nov 14 02:38:54 2006
@@ -67,15 +67,11 @@
         }
         synchronized (this.mutex) {
             setInputMode();
-            int total = 0;
-            int bytesRead = 0;
-            while ((bytesRead = decoder.read(this.buffer)) > 0) {
-                total += bytesRead;
-            }
+            int bytesRead = decoder.read(this.buffer);
             if (bytesRead == -1 || decoder.isCompleted()) {
                 this.endOfStream = true;
             }
-            if (total > 0) {
+            if (bytesRead > 0) {
                 this.ioctrl.suspendInput();
                 this.mutex.notifyAll();            
             }



Mime
View raw message