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 2015/03/28 22:47:55 UTC

svn commit: r1669838 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java

Author: markt
Date: Sat Mar 28 21:47:55 2015
New Revision: 1669838

URL: http://svn.apache.org/r1669838
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57762
Dropped connections are reported as a success with EOF rather than as a failure.

Modified:
    tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java?rev=1669838&r1=1669837&r2=1669838&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java Sat Mar 28 21:47:55 2015
@@ -16,6 +16,7 @@
  */
 package org.apache.tomcat.websocket;
 
+import java.io.EOFException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.CompletionHandler;
@@ -109,6 +110,16 @@ public class WsFrameClient extends WsFra
 
         @Override
         public void completed(Integer result, Void attachment) {
+            if (result.intValue() == -1) {
+                // BZ 57762. A dropped connection will get reported as EOF
+                // rather than as an error so handle it here.
+                if (isOpen()) {
+                    // No close frame was received
+                    close(new EOFException());
+                }
+                // No data to process
+                return;
+            }
             response.flip();
             try {
                 processSocketRead();



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


Re: svn commit: r1669838 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java

Posted by Mark Thomas <ma...@apache.org>.
On 31/03/2015 13:11, Rémy Maucherat wrote:
> 2015-03-28 22:47 GMT+01:00 <ma...@apache.org>:
> 
>> Author: markt
>> Date: Sat Mar 28 21:47:55 2015
>> New Revision: 1669838
>>
>> URL: http://svn.apache.org/r1669838
>> Log:
>> Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57762
>> Dropped connections are reported as a success with EOF rather than as a
>> failure.
>>
> 
> That does sound like a NIO2 bug, right ?

It certainly isn't what I would have expected. I agree it sounds like a
bug and I'd be surprised if the underlying OS didn't provide a way to
differentiate between the two cases.

Mark


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


Re: svn commit: r1669838 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameClient.java

Posted by Rémy Maucherat <re...@apache.org>.
2015-03-28 22:47 GMT+01:00 <ma...@apache.org>:

> Author: markt
> Date: Sat Mar 28 21:47:55 2015
> New Revision: 1669838
>
> URL: http://svn.apache.org/r1669838
> Log:
> Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=57762
> Dropped connections are reported as a success with EOF rather than as a
> failure.
>

That does sound like a NIO2 bug, right ?

Rémy