This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 16d8754  Fix BZ 65763 - improve handling of timeout during message 
write
16d8754 is described below

commit 16d8754189808e771b8d6f0ad7dbd227aa5b9ef0
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jan 6 14:12:49 2022 +0000

    Fix BZ 65763 - improve handling of timeout during message write
    
    https://bz.apache.org/bugzilla/show_bug.cgi?id=65763
---
 java/org/apache/tomcat/websocket/WsSession.java | 3 +--
 webapps/docs/changelog.xml                      | 4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/WsSession.java 
b/java/org/apache/tomcat/websocket/WsSession.java
index 2f3d7d3..91201d2 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -19,7 +19,6 @@ package org.apache.tomcat.websocket;
 import java.io.IOException;
 import java.net.URI;
 import java.nio.ByteBuffer;
-import java.nio.channels.WritePendingException;
 import java.nio.charset.StandardCharsets;
 import java.security.Principal;
 import java.util.Collections;
@@ -721,7 +720,7 @@ public class WsSession implements Session {
         msg.flip();
         try {
             wsRemoteEndpoint.sendMessageBlock(Constants.OPCODE_CLOSE, msg, 
true);
-        } catch (IOException | WritePendingException e) {
+        } catch (IOException | IllegalStateException e) {
             // Failed to send close message. Close the socket and let the 
caller
             // deal with the Exception
             if (log.isDebugEnabled()) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 683a49d..3538dbe 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -196,6 +196,10 @@
         Add support for the WebSocket 2.1 client-side API for configuring TLS
         connection for wss client connections. (markt)
       </add>
+      <fix>
+        <bug>65763</bug>: Improve handling of WebSocket connection close if a
+        message write times out before the message is fully written. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">

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

Reply via email to