openvidu-server: afterConnectionClosed redundancy removed

pull/73/head
pabloFuente 2018-05-08 14:58:32 +02:00
parent e7c6b9ebf9
commit cf31dc8cb6
2 changed files with 11 additions and 10 deletions

View File

@ -294,23 +294,23 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
@Override
public void afterConnectionEstablished(Session rpcSession) throws Exception {
log.info("Connection established for WebSocket session: {}", rpcSession.getSessionId());
log.info("After connection established for WebSocket session: {}", rpcSession.getSessionId());
}
@Override
public void afterConnectionClosed(Session rpcSession, String status) throws Exception {
log.info("Connection closed for WebSocket session: {} - Status: {}", rpcSession.getSessionId(), status);
RpcConnection rpc = this.notificationService.closeRpcSession(rpcSession.getSessionId());
if (rpc != null && rpc.getSessionId() != null) {
io.openvidu.server.core.Session session = this.sessionManager.getSession(rpc.getSessionId());
if (session != null && session.getParticipantByPrivateId(rpc.getParticipantPrivateId()) != null) {
leaveRoomAfterConnClosed(rpc.getParticipantPrivateId(), "networkDisconnect");
log.info("After connection closed for WebSocket session: {} - Status: {}", rpcSession.getSessionId(), status);
if ("Close for not receive ping from client".equals(status)) {
RpcConnection rpc = this.notificationService.closeRpcSession(rpcSession.getSessionId());
if (rpc != null && rpc.getSessionId() != null) {
io.openvidu.server.core.Session session = this.sessionManager.getSession(rpc.getSessionId());
if (session != null && session.getParticipantByPrivateId(rpc.getParticipantPrivateId()) != null) {
leaveRoomAfterConnClosed(rpc.getParticipantPrivateId(), "networkDisconnect");
}
}
}
this.notificationService.showRpcConnections();
String rpcSessionId = rpcSession.getSessionId();
if (this.webSocketTransportError.get(rpcSessionId) != null) {
log.warn(

View File

@ -112,6 +112,7 @@ public class RpcNotificationService {
try {
s.close();
log.info("Closed session for participant with private id {}", participantPrivateId);
this.showRpcConnections();
return rpcSession;
} catch (IOException e) {
log.error("Error closing session for participant with private id {}", participantPrivateId, e);