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 @Override
public void afterConnectionEstablished(Session rpcSession) throws Exception { 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 @Override
public void afterConnectionClosed(Session rpcSession, String status) throws Exception { public void afterConnectionClosed(Session rpcSession, String status) throws Exception {
log.info("Connection closed for WebSocket session: {} - Status: {}", rpcSession.getSessionId(), status); 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()); RpcConnection rpc = this.notificationService.closeRpcSession(rpcSession.getSessionId());
if (rpc != null && rpc.getSessionId() != null) { if (rpc != null && rpc.getSessionId() != null) {
io.openvidu.server.core.Session session = this.sessionManager.getSession(rpc.getSessionId()); io.openvidu.server.core.Session session = this.sessionManager.getSession(rpc.getSessionId());
if (session != null && session.getParticipantByPrivateId(rpc.getParticipantPrivateId()) != null) { if (session != null && session.getParticipantByPrivateId(rpc.getParticipantPrivateId()) != null) {
leaveRoomAfterConnClosed(rpc.getParticipantPrivateId(), "networkDisconnect"); leaveRoomAfterConnClosed(rpc.getParticipantPrivateId(), "networkDisconnect");
} }
} }
}
this.notificationService.showRpcConnections();
String rpcSessionId = rpcSession.getSessionId(); String rpcSessionId = rpcSession.getSessionId();
if (this.webSocketTransportError.get(rpcSessionId) != null) { if (this.webSocketTransportError.get(rpcSessionId) != null) {
log.warn( log.warn(

View File

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