- add more info on log so we can correlate with the red5 error.log if the client dropped because of connection problems

This commit is contained in:
Richard Alam 2010-11-25 15:59:07 -05:00
parent b456c92822
commit 095f532e35
2 changed files with 30 additions and 17 deletions

View File

@ -74,12 +74,17 @@ public class Application extends MultiThreadedApplicationAdapter {
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;
}
@ -90,8 +95,12 @@ public class Application extends MultiThreadedApplicationAdapter {
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) {

View File

@ -63,7 +63,7 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
@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);
@ -71,21 +71,28 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
@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();
@ -115,47 +122,44 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
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) {
@ -171,7 +175,7 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
@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();
}
}