/** * Removes client-connection association for given connection * * @param conn Connection object * @param deleteIfNoConns Whether to delete this client if it no longer has any connections */ protected void unregister(IConnection conn, boolean deleteIfNoConns) { // remove connection from connected scopes list connections.remove(conn); // If client is not connected to any scope any longer then remove if (deleteIfNoConns && connections.isEmpty()) { // TODO DW dangerous the way this is called from BaseConnection.initialize(). Could we // unexpectedly pop a Client out of the registry? removeInstance(); } }
/** Disconnects client from Red5 application */ public void disconnect() { log.debug("Disconnect - id: {}", id); if (connections != null && !connections.isEmpty()) { log.debug("Closing {} scope connections", connections.size()); // close all connections held to Red5 by client for (IConnection con : getConnections()) { try { con.close(); } catch (Exception e) { // closing a connection calls into application code, so exception possible log.error("Unexpected exception closing connection {}", e); } } } else { log.debug("Connection map is empty or null"); } // unregister client removeInstance(); }