- delay removing user from user's list in case the user is just reconnecting

This commit is contained in:
Richard Alam 2018-10-24 12:42:00 -07:00
parent eafa3273c5
commit 92a2cd0d60
5 changed files with 41 additions and 17 deletions

View File

@ -4,6 +4,7 @@ import org.bigbluebutton.common2.msgs.UserJoinMeetingAfterReconnectReqMsg
import org.bigbluebutton.core.apps.breakout.BreakoutHdlrHelpers
import org.bigbluebutton.core.apps.voice.UserJoinedVoiceConfEvtMsgHdlr
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.Users2x
import org.bigbluebutton.core.running.{ BaseMeetingActor, HandlerHelpers, LiveMeeting, OutMsgRouter }
trait UserJoinMeetingAfterReconnectReqMsgHdlr extends HandlerHelpers with BreakoutHdlrHelpers with UserJoinedVoiceConfEvtMsgHdlr {
@ -13,13 +14,23 @@ trait UserJoinMeetingAfterReconnectReqMsgHdlr extends HandlerHelpers with Breako
val outGW: OutMsgRouter
def handleUserJoinMeetingAfterReconnectReqMsg(msg: UserJoinMeetingAfterReconnectReqMsg, state: MeetingState2x): MeetingState2x = {
log.info("Received user joined after reconnecting. user " + msg.body.userId + " meetingId=" + msg.header.meetingId)
val newState = userJoinMeeting(outGW, msg.body.authToken, msg.body.clientType, liveMeeting, state)
if (liveMeeting.props.meetingProp.isBreakout) {
updateParentMeetingWithUsers()
Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) match {
case Some(reconnectingUser) =>
if (reconnectingUser.userLeftFlag.left) {
log.info("Resetting flag that user left meeting. user " + msg.body.userId)
// User has reconnected. Just reset it's flag. ralam Oct 23, 2018
Users2x.resetUserLeftFlag(liveMeeting.users2x, msg.body.userId)
}
state
case None =>
val newState = userJoinMeeting(outGW, msg.body.authToken, msg.body.clientType, liveMeeting, state)
if (liveMeeting.props.meetingProp.isBreakout) {
updateParentMeetingWithUsers()
}
newState
}
newState
}
}

View File

@ -2,7 +2,7 @@ package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs.UserJoinMeetingReqMsg
import org.bigbluebutton.core.apps.breakout.BreakoutHdlrHelpers
import org.bigbluebutton.core.models.VoiceUsers
import org.bigbluebutton.core.models.{ Users2x, VoiceUsers }
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.running.{ BaseMeetingActor, HandlerHelpers, LiveMeeting, OutMsgRouter }
@ -13,17 +13,28 @@ trait UserJoinMeetingReqMsgHdlr extends HandlerHelpers with BreakoutHdlrHelpers
val outGW: OutMsgRouter
def handleUserJoinMeetingReqMsg(msg: UserJoinMeetingReqMsg, state: MeetingState2x): MeetingState2x = {
val newState = userJoinMeeting(outGW, msg.body.authToken, msg.body.clientType, liveMeeting, state)
log.info("Received user joined meeting. user " + msg.body.userId + " meetingId=" + msg.header.meetingId)
if (liveMeeting.props.meetingProp.isBreakout) {
updateParentMeetingWithUsers()
Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) match {
case Some(reconnectingUser) =>
if (reconnectingUser.userLeftFlag.left) {
log.info("Resetting flag that user left meeting. user " + msg.body.userId)
// User has reconnected. Just reset it's flag. ralam Oct 23, 2018
Users2x.resetUserLeftFlag(liveMeeting.users2x, msg.body.userId)
}
state
case None =>
val newState = userJoinMeeting(outGW, msg.body.authToken, msg.body.clientType, liveMeeting, state)
if (liveMeeting.props.meetingProp.isBreakout) {
updateParentMeetingWithUsers()
}
// fresh user joined (not due to reconnection). Clear (pop) the cached voice user
VoiceUsers.recoverVoiceUser(liveMeeting.voiceUsers, msg.body.userId)
newState
}
// fresh user joined (not due to reconnection). Clear (pop) the cached voice user
VoiceUsers.recoverVoiceUser(liveMeeting.voiceUsers, msg.body.userId)
newState
}
}

View File

@ -15,7 +15,9 @@ trait UserLeaveReqMsgHdlr {
def handleUserLeaveReqMsg(msg: UserLeaveReqMsg, state: MeetingState2x): MeetingState2x = {
Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) match {
case Some(reconnectingUser) =>
log.info("Received user left meeting. user " + msg.body.userId + " meetingId=" + msg.header.meetingId)
if (!reconnectingUser.userLeftFlag.left) {
log.info("Setting user left flag. user " + msg.body.userId + " meetingId=" + msg.header.meetingId)
// Just flag that user has left as the user might be reconnecting.
// An audit will remove this user if it hasn't rejoined after a certain period of time.
// ralam oct 23, 2018

View File

@ -40,7 +40,7 @@ object Users2x {
def findAllExpiredUserLeftFlags(users: Users2x): Vector[UserState] = {
users.toVector filter (u => u.userLeftFlag.left && u.userLeftFlag.leftOn != 0 &&
System.currentTimeMillis() - u.userLeftFlag.leftOn > 60000)
System.currentTimeMillis() - u.userLeftFlag.leftOn > 10000)
}
def numUsers(users: Users2x): Int = {

View File

@ -418,7 +418,7 @@ class MeetingActor(
for {
u <- Users2x.remove(liveMeeting.users2x, leftUser.intId)
} yield {
log.info("User left meeting. meetingId=" + props.meetingProp.intId + " userId=" + u.intId + " user=" + u)
log.info("Removing user from meeting. meetingId=" + props.meetingProp.intId + " userId=" + u.intId + " user=" + u)
captionApp2x.handleUserLeavingMsg(leftUser.intId)