From 5b67dea506cbfbcae4057fb4eff89f3ef7fca4a6 Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Wed, 8 Feb 2023 18:09:49 +0000 Subject: [PATCH] Unwrap session before selecting stats counter See gh-29375 --- .../web/socket/messaging/SubProtocolWebSocketHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java index d629a9a92c..ea90a5797b 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,6 +47,7 @@ import org.springframework.web.socket.WebSocketMessage; import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; import org.springframework.web.socket.handler.SessionLimitExceededException; +import org.springframework.web.socket.handler.WebSocketSessionDecorator; import org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession; import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession; @@ -669,6 +670,7 @@ public class SubProtocolWebSocketHandler } AtomicInteger getCountFor(WebSocketSession session) { + session = WebSocketSessionDecorator.unwrap(session); if (session instanceof PollingSockJsSession) { return this.httpPolling; }