You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/02/23 23:28:32 UTC

svn commit: r1292995 - /tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java

Author: markt
Date: Thu Feb 23 22:28:32 2012
New Revision: 1292995

URL: http://svn.apache.org/viewvc?rev=1292995&view=rev
Log:
Review comments on r1292776 from kkolinko

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

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java?rev=1292995&r1=1292994&r2=1292995&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java (original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Thu Feb 23 22:28:32 2012
@@ -104,8 +104,8 @@ public class WsOutbound {
 
     /**
      * Flush any message (binary or textual) that may be buffered and then send
-     * the a WebSocket binary message as a single frame with the provided buffer
-     * as the payload of the message.
+     * a WebSocket binary message as a single frame with the provided buffer as
+     * the payload of the message.
      *
      * @param msgBb The buffer containing the payload
      *
@@ -123,8 +123,8 @@ public class WsOutbound {
 
     /**
      * Flush any message (binary or textual) that may be buffered and then send
-     * the a WebSocket text message as a single frame with the provided buffer
-     * as the payload of the message.
+     * a WebSocket text message as a single frame with the provided buffer as
+     * the payload of the message.
      *
      * @param msgBb The buffer containing the payload
      *
@@ -166,7 +166,7 @@ public class WsOutbound {
 
 
     /**
-     * Respond to a client close by sending a close that echos the status code
+     * Respond to a client close by sending a close that echoes the status code
      * and message.
      *
      * @param frame The close frame received from a client
@@ -274,7 +274,8 @@ public class WsOutbound {
             upgradeOutbound.write(0);
         } else {
             upgradeOutbound.write(data.limit());
-            upgradeOutbound.write(data.array(), 0, data.limit());
+            upgradeOutbound.write(data.array(), data.position(),
+                    data.limit() - data.position());
         }
 
         upgradeOutbound.flush();



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


Re: svn commit: r1292995 - /tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java

Posted by Mark Thomas <ma...@apache.org>.
On 23/02/2012 23:00, Konstantin Kolinko wrote:
> 2012/2/24  <ma...@apache.org>:
>> Author: markt
>> Date: Thu Feb 23 22:28:32 2012
>> New Revision: 1292995
>>
>> URL: http://svn.apache.org/viewvc?rev=1292995&view=rev
>> Log:
>> Review comments on r1292776 from kkolinko
>>
>> Modified:
>>    tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
>>
>> @@ -166,7 +166,7 @@ public class WsOutbound {
>>
>>
>>     /**
>> -     * Respond to a client close by sending a close that echos the status code
>> +     * Respond to a client close by sending a close that echoes the status code
>>      * and message.
>>      *
>>      * @param frame The close frame received from a client
>> @@ -274,7 +274,8 @@ public class WsOutbound {
>>             upgradeOutbound.write(0);
>>         } else {
>>             upgradeOutbound.write(data.limit());
> 
> The above line has to be changed as well.

Tx.

> BTW, what happens if we are passed more than 125 bytes of data? IAE?

Currently? The client should complain and close the connection.

We should probably stop that from happening.

Mark

> 
>> -            upgradeOutbound.write(data.array(), 0, data.limit());
>> +            upgradeOutbound.write(data.array(), data.position(),
>> +                    data.limit() - data.position());
>>         }
>>
>>         upgradeOutbound.flush();
>>
> 
> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 


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


Re: svn commit: r1292995 - /tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/2/24  <ma...@apache.org>:
> Author: markt
> Date: Thu Feb 23 22:28:32 2012
> New Revision: 1292995
>
> URL: http://svn.apache.org/viewvc?rev=1292995&view=rev
> Log:
> Review comments on r1292776 from kkolinko
>
> Modified:
>    tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
>
> @@ -166,7 +166,7 @@ public class WsOutbound {
>
>
>     /**
> -     * Respond to a client close by sending a close that echos the status code
> +     * Respond to a client close by sending a close that echoes the status code
>      * and message.
>      *
>      * @param frame The close frame received from a client
> @@ -274,7 +274,8 @@ public class WsOutbound {
>             upgradeOutbound.write(0);
>         } else {
>             upgradeOutbound.write(data.limit());

The above line has to be changed as well.
BTW, what happens if we are passed more than 125 bytes of data? IAE?

> -            upgradeOutbound.write(data.array(), 0, data.limit());
> +            upgradeOutbound.write(data.array(), data.position(),
> +                    data.limit() - data.position());
>         }
>
>         upgradeOutbound.flush();
>

Best regards,
Konstantin Kolinko

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