Skip to content

Commit 9a2097e

Browse files
committed
Address ws session id conversion to use as a hash code
1 parent 855c331 commit 9a2097e

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

server/src/main/java/org/red5/net/websocket/WebSocketConnection.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,24 +107,36 @@ public WebSocketConnection(WebSocketScope scope, Session session) {
107107
this.scope = scope;
108108
// set our path
109109
path = scope.getPath();
110-
log.debug("path: {}", path);
110+
if (isDebug) {
111+
log.debug("path: {}", path);
112+
}
111113
// cast ws session
112114
this.wsSession = (WsSession) session;
115+
if (isDebug) {
116+
log.debug("ws session: {}", wsSession);
117+
}
113118
// the websocket session id will be used for hash code comparison, its the only usable value currently
114119
wsSessionId = wsSession.getId();
115-
hashCode = Integer.valueOf(wsSessionId);
116-
log.info("wsSessionId: {}", wsSessionId);
120+
if (isDebug) {
121+
log.debug("wsSessionId: {}", wsSessionId);
122+
}
123+
hashCode = wsSessionId.hashCode();
124+
log.info("ws id: {} hashCode: {}", wsSessionId, hashCode);
117125
// get extensions
118126
List<Extension> extList = wsSession.getNegotiatedExtensions();
119127
if (extList != null) {
120128
extList.forEach(extension -> {
121129
extensions.put(extension.getName(), extension);
122130
});
123131
}
124-
log.debug("extensions: {}", extensions);
132+
if (isDebug) {
133+
log.debug("extensions: {}", extensions);
134+
}
125135
// get querystring
126136
String queryString = wsSession.getQueryString();
127-
log.debug("queryString: {}", queryString);
137+
if (isDebug) {
138+
log.debug("queryString: {}", queryString);
139+
}
128140
if (StringUtils.isNotBlank(queryString)) {
129141
// bust it up by ampersand
130142
String[] qsParams = queryString.split("&");

0 commit comments

Comments
 (0)