Skip to content

Commit

Permalink
Updated to 1.3.11. Added close for ws timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
mondain committed Nov 7, 2022
1 parent 45b131d commit 75158a4
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 60 deletions.
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.red5</groupId>
<artifactId>red5-parent</artifactId>
<version>1.3.10</version>
<version>1.3.11</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>red5-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client/src/main/java/org/red5/client/Red5Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class Red5Client {
/**
* Current server version with revision
*/
public static final String VERSION = "Red5 Client 1.3.10";
public static final String VERSION = "Red5 Client 1.3.11";

/**
* Create a new Red5Client object using the connection local to the current thread A bit of magic that lets you access the red5 scope
Expand Down
4 changes: 2 additions & 2 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.red5</groupId>
<artifactId>red5-parent</artifactId>
<version>1.3.10</version>
<version>1.3.11</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>red5-server-common</artifactId>
Expand Down Expand Up @@ -124,7 +124,7 @@
<dependency>
<groupId>net.engio</groupId>
<artifactId>mbassador</artifactId>
<version>1.3.10</version>
<version>1.3.11</version>
</dependency> -->
<dependency>
<groupId>junit</groupId>
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/org/red5/server/api/Red5.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public final class Red5 {
/**
* Server version with revision
*/
public static final String VERSION = "Red5 Server 1.3.10";
public static final String VERSION = "Red5 Server 1.3.11";

/**
* Server version for fmsVer requests
*/
public static final String FMS_VERSION = "RED5/1,3,10,0";
public static final String FMS_VERSION = "RED5/1,3,11,0";

/**
* Server capabilities
Expand Down
2 changes: 1 addition & 1 deletion io/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.red5</groupId>
<artifactId>red5-parent</artifactId>
<version>1.3.10</version>
<version>1.3.11</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>red5-io</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<name>Red5</name>
<description>The Red5 server</description>
<groupId>org.red5</groupId>
<version>1.3.10</version>
<version>1.3.11</version>
<url>https://github.com/Red5/red5-server</url>
<inceptionYear>2005</inceptionYear>
<organization>
Expand Down
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.red5</groupId>
<artifactId>red5-parent</artifactId>
<version>1.3.10</version>
<version>1.3.11</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>red5-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,33 +320,14 @@ public void close() {
if (connected.compareAndSet(true, false)) {
log.debug("close: {}", wsSessionId);
WsSession session = wsSession != null ? wsSession.get() : null;
//WebSocketScopeManager manager = null;
// session has to be open, or user props cannot be retrieved
if (session != null && session.isOpen()) {
//Map<String, Object> propsMap = session.getUserProperties();
// lookup the manager
//manager = (WebSocketScopeManager) propsMap.get(WSConstants.WS_MANAGER);
// trying to close the session nicely
try {
session.close();
} catch (Exception e) {
log.debug("Exception closing session", e);
}
/*
// check for upgrade handler, if its around close it
WsHttpUpgradeHandler upgrader = (WsHttpUpgradeHandler) propsMap.get(WSConstants.WS_UPGRADE_HANDLER);
// ensure the endpoint is closed
CloseReason reason = new CloseReason(CloseCodes.GOING_AWAY, "");
// close the socket, don't wait for the browser to respond or we could hang
session.onClose(reason);
if (upgrader != null) {
try {
upgrader.destroy();
} catch (Exception e) {
log.debug("Exception destroying http upgrader", e);
}
}
*/
}
// clean up our props
attributes.clear();
Expand All @@ -361,10 +342,6 @@ public void close() {
if (headers != null) {
headers = null;
}
// fire callback for manager
//if (manager != null) {
// manager.removeConnection(this);
//}
if (scope.get() != null) {
// disconnect from scope
scope.get().removeConnection(this);
Expand All @@ -380,10 +357,10 @@ public void timeoutAsync(long now) {
log.debug("timeoutAsync: {} on {} last read: {} last write: {}", now, wsSessionId, readDelta, writeDelta);
if (isConnected()) {
// if the delta is less than now, then the last time isn't 0
if (readDelta < now && readDelta > readTimeout) {
if (readDelta != now && readDelta > readTimeout) {
log.warn("Read timeout: {} on id: {}", readDelta, wsSessionId);
//close();
} else if (writeDelta < now && writeDelta > sendTimeout) {
close();
} else if (writeDelta != now && writeDelta > sendTimeout) {
log.warn("Write timeout: {} on id: {}", writeDelta, wsSessionId);
close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,48 +142,24 @@ public void init(WebConnection connection) {
wsSession = new WsSession(ep, wsRemoteEndpointServer, webSocketContainer, handshakeRequest.getRequestURI(), handshakeRequest.getParameterMap(), handshakeRequest.getQueryString(), handshakeRequest.getUserPrincipal(), httpSessionId, negotiatedExtensions, subProtocol, pathParameters, secure, endpointConfig);
// newest ctor
//wsSession = new WsSession(wsRemoteEndpointServer, webSocketContainer, handshakeRequest.getRequestURI(), handshakeRequest.getParameterMap(), handshakeRequest.getQueryString(), handshakeRequest.getUserPrincipal(), httpSessionId, negotiatedExtensions, subProtocol, pathParameters, secure, endpointConfig);
if (isTrace) {
log.trace("New connection 2 {}", wsSession);
}
wsFrame = new WsFrameServer(socketWrapper, upgradeInfo, wsSession, transformation, applicationClassLoader);
if (isTrace) {
log.trace("New connection 3 {}", wsFrame);
}
// WsFrame adds the necessary final transformations. Copy the completed transformation chain to the remote end point.
wsRemoteEndpointServer.setTransformation(wsFrame.getTransformation());
if (isTrace) {
log.trace("New connection 4");
}
// get the ws scope manager from user props
WebSocketScopeManager manager = (WebSocketScopeManager) endpointConfig.getUserProperties().get(WSConstants.WS_MANAGER);
if (isTrace) {
log.trace("New connection 5");
}
// get ws scope from user props
WebSocketScope scope = (WebSocketScope) endpointConfig.getUserProperties().get(WSConstants.WS_SCOPE);
if (isTrace) {
log.trace("New connection 6 - Scope: {} WS session: {}", scope, wsSession);
}
// create a ws connection instance
WebSocketConnection conn = new WebSocketConnection(scope, wsSession);
// in debug check since WebSocketConnection.toString is a tiny bit expensive
if (isTrace) {
log.trace("New connection 7: {}", conn);
}
// set ip and port
conn.setAttribute(WSConstants.WS_HEADER_REMOTE_IP, socketWrapper.getRemoteAddr());
conn.setAttribute(WSConstants.WS_HEADER_REMOTE_PORT, socketWrapper.getRemotePort());
// add the request headers
conn.setHeaders(handshakeRequest.getHeaders());
if (isTrace) {
log.trace("New connection 8: {}", conn);
}
// add the connection to the user props
endpointConfig.getUserProperties().put(WSConstants.WS_CONNECTION, conn);
// must be added to the session as well since the session ctor copies from the endpoint and doesnt update
wsSession.getUserProperties().put(WSConstants.WS_CONNECTION, conn);
// set the upgrade handler so it can be destroyed when ws conn is closed
wsSession.getUserProperties().put(WSConstants.WS_UPGRADE_HANDLER, this);
// set connected flag
conn.setConnected();
// fire endpoint handler
Expand Down
2 changes: 1 addition & 1 deletion service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.red5</groupId>
<artifactId>red5-parent</artifactId>
<version>1.3.10</version>
<version>1.3.11</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>red5-service</artifactId>
Expand Down

0 comments on commit 75158a4

Please sign in to comment.