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

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

commit 13587bbb80df5f3f874eece098d503d6024e3406
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Aug 7 16:04:22 2024 +0100

    Add trace logging for receipt of WebSocket session close message
---
 java/org/apache/tomcat/websocket/LocalStrings.properties | 1 +
 java/org/apache/tomcat/websocket/WsSession.java          | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 79b8472007..6948b7514d 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -116,6 +116,7 @@ wsSession.instanceCreateFailed=Endpoint instance creation 
failed
 wsSession.instanceNew=Endpoint instance registration failed
 wsSession.invalidHandlerTypePong=A pong message handler must implement 
MessageHandler.Whole
 wsSession.messageFailed=Unable to write the complete message as the WebSocket 
connection has been closed
+wsSession.onClose.entry=Close message with reason [{0}] received for session 
[{1}] in state [{2}]
 wsSession.removeHandlerFailed=Unable to remove the handler [{0}] as it was not 
registered with this session
 wsSession.sendCloseFail=Failed to send close message for session [{0}] to 
remote endpoint
 wsSession.timeout=The WebSocket session [{0}] idle timeout expired
diff --git a/java/org/apache/tomcat/websocket/WsSession.java 
b/java/org/apache/tomcat/websocket/WsSession.java
index 7b66df3374..f1ffbc2002 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -621,6 +621,9 @@ public class WsSession implements Session {
      * @param closeReason The reason contained within the received close 
message.
      */
     public void onClose(CloseReason closeReason) {
+        if (log.isTraceEnabled()) {
+            log.trace(sm.getString("wsSession.onClose.entry", closeReason, 
getId(), state));
+        }
         if (state.compareAndSet(State.OPEN, State.CLOSING)) {
             // Standard close.
 


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

Reply via email to