- try to figure out why meeting doesn't end when user leaves

This commit is contained in:
Richard Alam 2017-07-17 14:59:31 -07:00
parent 61147dbb67
commit e62efc3820
3 changed files with 16 additions and 23 deletions

View File

@ -58,13 +58,13 @@ object MeetingExpiryTracker {
}
def setUserHasJoined(state: MeetingState2x): MeetingState2x = {
state.expiryTracker.modify(_.userHasJoined).setTo(true)
state
val tracker = state.expiryTracker.modify(_.userHasJoined).setTo(true)
state.modify(_.expiryTracker).setTo(tracker)
}
def setLastUserLeftOn(state: MeetingState2x, timestampInSeconds: Long): MeetingState2x = {
state.expiryTracker.modify(_.lastUserLeftOn).setTo(timestampInSeconds)
state
val tracker = state.expiryTracker.modify(_.lastUserLeftOn).setTo(timestampInSeconds)
state.modify(_.expiryTracker).setTo(tracker)
}
def hasMeetingExpiredNeverBeenJoined(state: MeetingState2x, nowInSeconds: Long): Boolean = {

View File

@ -5,7 +5,7 @@ import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.api.{ BreakoutRoomEndedInternalMsg, DestroyMeetingInternalMsg, RecordingStatusChanged }
import org.bigbluebutton.core.bus.{ BigBlueButtonEvent, IncomingEventBus }
import org.bigbluebutton.core.domain.{ MeetingExpiryTracker, MeetingState2x }
import org.bigbluebutton.core.{ MessageRecorder, OutMessageGateway }
import org.bigbluebutton.core.{ OutMessageGateway }
import org.bigbluebutton.core.models._
import org.bigbluebutton.core2.MeetingStatus2x
import org.bigbluebutton.core2.message.senders.{ MsgBuilder, Sender, UserJoinedMeetingEvtMsgBuilder }
@ -13,33 +13,31 @@ import org.bigbluebutton.core2.message.senders.{ MsgBuilder, Sender, UserJoinedM
trait HandlerHelpers extends SystemConfiguration {
def validateTokenFailed(outGW: OutMessageGateway, meetingId: String, userId: String, authToken: String,
valid: Boolean, waitForApproval: Boolean): Unit = {
val event = MsgBuilder.buildValidateAuthTokenRespMsg(
meetingId,
userId, authToken, valid, waitForApproval
)
valid: Boolean, waitForApproval: Boolean, state: MeetingState2x): MeetingState2x = {
val event = MsgBuilder.buildValidateAuthTokenRespMsg(meetingId, userId, authToken, valid, waitForApproval)
Sender.send(outGW, event)
// TODO: Should disconnect user here.
state
}
def sendValidateAuthTokenRespMsg(outGW: OutMessageGateway, meetingId: String, userId: String, authToken: String,
valid: Boolean, waitForApproval: Boolean): Unit = {
val event = MsgBuilder.buildValidateAuthTokenRespMsg(
meetingId,
userId, authToken, valid, waitForApproval
)
val event = MsgBuilder.buildValidateAuthTokenRespMsg(meetingId, userId, authToken, valid, waitForApproval)
Sender.send(outGW, event)
}
def userValidatedButNeedToWaitForApproval(outGW: OutMessageGateway, liveMeeting: LiveMeeting,
user: RegisteredUser): Unit = {
user: RegisteredUser, state: MeetingState2x): MeetingState2x = {
val meetingId = liveMeeting.props.meetingProp.intId
sendValidateAuthTokenRespMsg(outGW, meetingId, user.id, user.authToken, valid = true, waitForApproval = false)
val guest = GuestWaiting(user.id, user.name, user.role)
addGuestToWaitingForApproval(guest, liveMeeting.guestsWaiting)
notifyModeratorsOfGuestWaiting(outGW, Vector(guest), liveMeeting.users2x, meetingId)
state
}
def addGuestToWaitingForApproval(guest: GuestWaiting, guestsWaitingList: GuestsWaiting): Unit = {

View File

@ -23,22 +23,17 @@ trait ValidateAuthTokenReqMsgHdlr extends HandlerHelpers {
userValidatedAndNoNeedToWaitForApproval(outGW, liveMeeting, u, state)
} else if (guestPolicyType == GuestPolicyType.ASK_MODERATOR) {
if (u.guest && u.waitingForAcceptance) {
userValidatedButNeedToWaitForApproval(outGW, liveMeeting, u)
state
userValidatedButNeedToWaitForApproval(outGW, liveMeeting, u, state)
} else {
userValidatedAndNoNeedToWaitForApproval(outGW, liveMeeting, u, state)
}
} else {
validateTokenFailed(outGW, meetingId = liveMeeting.props.meetingProp.intId,
userId = msg.body.userId, authToken = msg.body.authToken, valid = false, waitForApproval = false)
// TODO: Disconnect user
state
userId = msg.body.userId, authToken = msg.body.authToken, valid = false, waitForApproval = false, state)
}
case None =>
validateTokenFailed(outGW, meetingId = liveMeeting.props.meetingProp.intId,
userId = msg.body.userId, authToken = msg.body.authToken, valid = false, waitForApproval = false)
// TODO: Disconnect user
state
userId = msg.body.userId, authToken = msg.body.authToken, valid = false, waitForApproval = false, state)
}
}
}