Author: markt
Date: Wed Mar  6 17:23:57 2013
New Revision: 1453439

URL: http://svn.apache.org/r1453439
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54612
Check if socket is closed before trying to write a message to it.
Also, flush any partial buffered data before closing the socket.
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=1453439&r1=1453438&r2=1453439&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java (original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Wed Mar  6 
17:23:57 2013
@@ -269,6 +269,10 @@ public class WsOutbound {
         if (closed) {
             return;
         }
+
+        // Send any partial data we have
+        doFlush(false);
+
         closed = true;
 
         outputStream.write(0x88);
@@ -355,6 +359,10 @@ public class WsOutbound {
     private void doWriteBytes(ByteBuffer buffer, boolean finalFragment)
             throws IOException {
 
+        if (closed) {
+            throw new IOException(sm.getString("outbound.closed"));
+        }
+
         // Work out the first byte
         int first = 0x00;
         if (finalFragment) {



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

Reply via email to