You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2014/06/01 13:51:44 UTC

svn commit: r1598971 - in /tomcat/trunk/java/org/apache/coyote/http11: Http11Nio2Protocol.java upgrade/Nio2ServletInputStream.java

Author: remm
Date: Sun Jun  1 11:51:43 2014
New Revision: 1598971

URL: http://svn.apache.org/r1598971
Log:
Fix regression with the websockets examples after fixing the testing. The initial notification is still problematic.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java
    tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java?rev=1598971&r1=1598970&r2=1598971&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java Sun Jun  1 11:51:43 2014
@@ -17,6 +17,7 @@
 package org.apache.coyote.http11;
 
 import java.io.IOException;
+import java.nio.channels.ReadPendingException;
 
 import javax.net.ssl.SSLEngine;
 import javax.servlet.http.HttpUpgradeHandler;
@@ -224,7 +225,13 @@ public class Http11Nio2Protocol extends 
                 ((Nio2Endpoint) proto.endpoint).addTimeout(socket);
             } else if (processor.isUpgrade()) {
                 if (((Nio2SocketWrapper) socket).isUpgradeInit()) {
-                    ((Nio2Endpoint) proto.endpoint).awaitBytes(socket);
+                    try {
+                        ((Nio2Endpoint) proto.endpoint).awaitBytes(socket);
+                    } catch (ReadPendingException e) {
+                        // Ignore, the initial state after upgrade is
+                        // impossible to predict, and a read must be pending
+                        // to get a first notification
+                    }
                 }
             } else {
                 // Either:

Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java?rev=1598971&r1=1598970&r2=1598971&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java Sun Jun  1 11:51:43 2014
@@ -40,7 +40,7 @@ public class Nio2ServletInputStream exte
     private final CompletionHandler<Integer, SocketWrapper<Nio2Channel>> completionHandler;
     private boolean flipped = false;
     private volatile boolean readPending = false;
-    private volatile boolean interest = false;
+    private volatile boolean interest = true;
 
     public Nio2ServletInputStream(SocketWrapper<Nio2Channel> wrapper, AbstractEndpoint<Nio2Channel> endpoint0) {
         this.endpoint = endpoint0;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org