-
Notifications
You must be signed in to change notification settings - Fork 363
Check for meetingId conflicts #1233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
d649eae
9ab91d1
a4b1687
9c15953
9f219f2
4c415b3
d7a14ab
16e794e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,7 +49,6 @@ | |
| import org.jxmpp.jid.*; | ||
|
|
||
| import java.time.*; | ||
| import java.net.*; | ||
| import java.util.*; | ||
| import java.util.concurrent.*; | ||
| import java.util.concurrent.atomic.*; | ||
|
|
@@ -257,7 +256,7 @@ public class JitsiMeetConferenceImpl | |
| * Whether broadcasting to visitors is currently enabled. | ||
| * TODO: support changing it. | ||
| */ | ||
| private boolean visitorsBroadcastEnabled = VisitorsConfig.config.getAutoEnableBroadcast(); | ||
| private final boolean visitorsBroadcastEnabled = VisitorsConfig.config.getAutoEnableBroadcast(); | ||
|
|
||
| @NotNull private final Instant createdInstant = Instant.now(); | ||
|
|
||
|
|
@@ -506,6 +505,39 @@ public boolean isStarted() | |
| return started.get(); | ||
| } | ||
|
|
||
| /** | ||
| * Initialize {@link #meetingId}, given an optional value coming from the chat room configuration. If no valid | ||
| * meeting ID is provided, a random UUID will be generated. | ||
| * @param chatRoomMeetingId the meeting ID that was set in the chat room configuration. | ||
| */ | ||
| private void setMeetingId(String chatRoomMeetingId) | ||
| { | ||
| if (meetingId != null) | ||
| { | ||
| logger.error("Meeting ID is already set: " + meetingId + ", will not replace."); | ||
| return; | ||
| } | ||
|
|
||
| String meetingId; | ||
| if (org.apache.commons.lang3.StringUtils.isBlank(chatRoomMeetingId)) | ||
| { | ||
| meetingId = UUID.randomUUID().toString(); | ||
| logger.warn("No meetingId set for the MUC. Generating one locally."); | ||
| } | ||
| else | ||
| { | ||
| meetingId = chatRoomMeetingId; | ||
| } | ||
|
|
||
| if (!listener.meetingIdSet(this, meetingId)) | ||
| { | ||
| logger.error("Failed to set a unique meeting ID after 100 attempts, giving up."); | ||
|
||
| throw new RuntimeException("Failed to set a unique meeting ID."); | ||
| } | ||
|
|
||
| this.meetingId = meetingId; | ||
| logger.addContext("meeting_id", meetingId); | ||
| } | ||
| /** | ||
| * Joins the conference room. | ||
| * | ||
|
|
@@ -521,16 +553,7 @@ private void joinTheRoom() | |
| chatRoom.addListener(chatRoomListener); | ||
|
|
||
| ChatRoomInfo chatRoomInfo = chatRoom.join(); | ||
| if (chatRoomInfo.getMeetingId() == null) | ||
| { | ||
| meetingId = UUID.randomUUID().toString(); | ||
| logger.warn("No meetingId set for the MUC. Generating one locally."); | ||
| } | ||
| else | ||
| { | ||
| this.meetingId = chatRoomInfo.getMeetingId(); | ||
| } | ||
| logger.addContext("meeting_id", meetingId); | ||
| setMeetingId(chatRoomInfo.getMeetingId()); | ||
|
|
||
| mainRoomJid = chatRoomInfo.getMainRoomJid(); | ||
|
|
||
|
|
@@ -998,7 +1021,7 @@ private void onMemberLeft(ChatRoomMember chatRoomMember) | |
| { | ||
| rescheduleSingleParticipantTimeout(); | ||
| } | ||
| else if (participants.size() == 0) | ||
| else if (participants.isEmpty()) | ||
| { | ||
| expireBridgeSessions(); | ||
| } | ||
|
|
@@ -1098,7 +1121,7 @@ else if (removed.getChatMember().getRole() == MemberRole.VISITOR) | |
| } | ||
|
|
||
| @Override | ||
| public void componentsChanged(Set<XmppProvider.Component> components) | ||
| public void componentsChanged(@NotNull Set<XmppProvider.Component> components) | ||
| { | ||
| } | ||
|
|
||
|
|
@@ -1903,7 +1926,7 @@ private long getUserParticipantCount() | |
|
|
||
| /** | ||
| * Selects a visitor node for a new participant, and joins the associated chat room if not already joined | ||
| * @return | ||
| * @return the ID of the selected node, or null if the endpoint is to be sent to the main room. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Annotate return type with |
||
| * @throws Exception if joining the chat room failed. | ||
| */ | ||
| private String selectVisitorNode() | ||
|
|
@@ -2334,7 +2357,17 @@ public interface ConferenceListener | |
| * Event fired when conference has ended. | ||
| * @param conference the conference instance that has ended. | ||
| */ | ||
| void conferenceEnded(JitsiMeetConferenceImpl conference); | ||
| void conferenceEnded(@NotNull JitsiMeetConferenceImpl conference); | ||
|
|
||
| /** | ||
| * Fire an event attempting to set the meeting ID for the conference. The implementation should return `false` | ||
| * in case another meeting with the same ID already exists, which will result in a new randomly generated | ||
| * meeting ID to be attempted. | ||
|
||
| * @param conference the conference. | ||
| * @param meetingId the meetindId to attempt. | ||
| * @return true if the given meetingId was free and was associated with the conference, false otherwise. | ||
| */ | ||
| boolean meetingIdSet(@NotNull JitsiMeetConferenceImpl conference, @NotNull String meetingId); | ||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be imported?