Skip to content

Commit

Permalink
- add more info on log so we can correlate with the red5 error.log i…
Browse files Browse the repository at this point in the history
…f the client dropped because of connection problems
  • Loading branch information
ritzalam committed Nov 25, 2010
1 parent b456c92 commit 095f532
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,17 @@ public boolean appConnect(IConnection conn, Object[] params) {
String userid = ((String) params[0]).toString();
String username = ((String) params[1]).toString();
String clientId = Red5.getConnectionLocal().getClient().getId();
String remoteHost = Red5.getConnectionLocal().getRemoteAddress();
int remotePort = Red5.getConnectionLocal().getRemotePort();

if ((userid == null) || ("".equals(userid))) userid = "unknown-userid";
if ((username == null) || ("".equals(username))) username = "UNKNOWN-CALLER";
Red5.getConnectionLocal().setAttribute("USERID", userid);
Red5.getConnectionLocal().setAttribute("USERNAME", username);

log.info("{} [clientid={}] has connected to the voice conf app.", username + "[uid=" + userid + "]", clientId);
log.info("[clientid={}] connected from {}.", clientId, remoteHost + ":" + remotePort);

clientConnManager.createClient(clientId, userid, username, (IServiceCapableConnection) Red5.getConnectionLocal());
return true;
}
Expand All @@ -90,8 +95,12 @@ public void appDisconnect(IConnection conn) {
String userid = getUserId();
String username = getUsername();

String remoteHost = Red5.getConnectionLocal().getRemoteAddress();
int remotePort = Red5.getConnectionLocal().getRemotePort();
log.info("[clientid={}] disconnnected from {}.", clientId, remoteHost + ":" + remotePort);
log.debug("{} [clientid={}] is leaving the voice conf app. Removing from ConnectionManager.", username + "[uid=" + userid + "]", clientId);
clientConnManager.removeClient(clientId);

clientConnManager.removeClient(clientId);

String peerId = (String) Red5.getConnectionLocal().getAttribute("VOICE_CONF_PEER");
if (peerId != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,36 @@ public void appStop(IScope app) {

@Override
public boolean roomStart(IScope room) {
log.debug("{} - roomStart ", APP);
log.debug("Starting room [{}].", room.getName());
assert participantsApplication != null;
participantsApplication.createRoom(room.getName());
return super.roomStart(room);
}

@Override
public void roomStop(IScope room) {
log.debug("{} - roomStop", APP);
log.debug("Stopping room [{}]", room.getName());
super.roomStop(room);
assert participantsApplication != null;
participantsApplication.destroyRoom(room.getName());
BigBlueButtonSession bbbSession = getBbbSession();
assert bbbSession != null;
log.debug("{} - roomStop - destroying RecordSession {}", APP, bbbSession.getSessionName());

/**
* Need to figure out if the next 2 lines should be removed. (ralam nov 25, 2010).
*/
assert recorderApplication != null;
recorderApplication.destroyRecordSession(bbbSession.getSessionName());
log.debug("{} - roomStop - destroyed RecordSession {}", APP, bbbSession.getSessionName());

log.debug("Stopped room [{}]", room.getName());
}

@Override
public boolean roomConnect(IConnection connection, Object[] params) {
log.debug("{} - roomConnect - ", APP);
String remoteHost = Red5.getConnectionLocal().getRemoteAddress();
int remotePort = Red5.getConnectionLocal().getRemotePort();
String clientId = Red5.getConnectionLocal().getClient().getId();
log.info("[clientid={}] connected from {}.", clientId, remoteHost + ":" + remotePort);

String username = ((String) params[0]).toString();
String role = ((String) params[1]).toString();
Expand Down Expand Up @@ -115,47 +122,44 @@ boolean record = (Boolean)params[6];

String debugInfo = "userid=" + userid + ",username=" + username + ",role=" + role + ",conference=" + conference + "," +
"session=" + sessionName + ",voiceConf=" + voiceBridge + ",room=" + room + ",externsUserid=" + externUserID;
log.debug("roomConnect - [{}]", debugInfo);

log.info("User Joined [{}, {}]", username, room);
log.debug("User [{}] connected to room [{}]", debugInfo, room);
super.roomConnect(connection, params);
return true;
}

@Override
public void roomDisconnect(IConnection conn) {
String remoteHost = Red5.getConnectionLocal().getRemoteAddress();
int remotePort = Red5.getConnectionLocal().getRemotePort();
String clientId = Red5.getConnectionLocal().getClient().getId();
log.info("[clientid={}] disconnnected from {}.", clientId, remoteHost + ":" + remotePort);

BigBlueButtonSession bbbSession = (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION);
log.info("User Left [{}, {}]", bbbSession.getUsername(), bbbSession.getRoom());
log.info("User [{}] disconnected from room [{}]", bbbSession.getUsername(), bbbSession.getRoom());
super.roomDisconnect(conn);
}

public String getMyUserId() {
log.debug("Getting userid for connection.");
BigBlueButtonSession bbbSession = (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION);
assert bbbSession != null;
return bbbSession.getUserid()+"";
}

public void setParticipantsApplication(ParticipantsApplication a) {
log.debug("Setting participants application");
participantsApplication = a;
}

public void setRecorderApplication(RecorderApplication a) {
log.debug("Setting recorder application");
recorderApplication = a;
}

public void setApplicationListeners(Set<IApplication> listeners) {
log.debug("Setting application listeners");
int count = 0;
Iterator<IApplication> iter = listeners.iterator();
while (iter.hasNext()) {
log.debug("Setting application listeners {}", count);
super.addListener((IApplication) iter.next());
count++;
}
log.debug("Finished Setting application listeners");
}

public void setVersion(String v) {
Expand All @@ -171,7 +175,7 @@ private class ShutdownHookListener implements ApplicationListener<ApplicationEve
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof org.springframework.context.event.ContextStoppedEvent) {
log.info("Received shutdown event. Destroying all rooms.");
log.info("Received shutdown event. Red5 is shutting down. Destroying all rooms.");
participantsApplication.destroyAllRooms();
}
}
Expand Down

0 comments on commit 095f532

Please sign in to comment.