tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1291523 - /tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
Date Mon, 20 Feb 2012 23:42:52 GMT
Author: markt
Date: Mon Feb 20 23:42:51 2012
New Revision: 1291523

URL: http://svn.apache.org/viewvc?rev=1291523&view=rev
Log:
Mask is per fragment so track position against mask per fragment.
Remove some completed TODOs.

Modified:
    tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java?rev=1291523&r1=1291522&r2=1291523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java (original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Mon Feb 20 23:42:51
2012
@@ -30,7 +30,7 @@ public class WsInputStream extends java.
 
 
     private long remaining;
-    private long read;
+    private long readThisFragment;
 
     public WsInputStream(UpgradeProcessor<?> processor) throws IOException {
         this.processor = processor;
@@ -43,11 +43,6 @@ public class WsInputStream extends java.
 
         // TODO: Per frame extension handling is not currently supported.
 
-        // TODO: Handle other control frames.
-
-        // TODO: Handle control frames appearing in the middle of a multi-frame
-        //       message
-
         int i = processor.read();
         this.wsFrameHeader = new WsFrameHeader(i);
 
@@ -73,6 +68,8 @@ public class WsInputStream extends java.
         for (int j = 0; j < mask.length; j++) {
             mask[j] = processor.read() & 0xFF;
         }
+
+        readThisFragment = 0;
     }
 
     public WsFrameHeader getFrameHeader() {
@@ -103,12 +100,12 @@ public class WsInputStream extends java.
         }
 
         remaining--;
-        read++;
+        readThisFragment++;
 
         int masked = processor.read();
         if(masked == -1) {
             return -1;
         }
-        return masked ^ mask[(int) ((read - 1) % 4)];
+        return masked ^ mask[(int) ((readThisFragment - 1) % 4)];
     }
 }



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


Mime
View raw message