Skip to content
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

fix: Do not leave the conference soon after a conference-request. #1119

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ public class JitsiMeetConferenceImpl
@Nullable
private String meetingId;

/**
* The time at which the last conference request for this conference was received.
*/
private long lastConferenceRequestReceived = -1;

/**
* Creates new instance of {@link JitsiMeetConferenceImpl}.
*
Expand Down Expand Up @@ -961,7 +966,25 @@ else if (participants.size() == 0)
}
}

maybeStop();
long timeSinceLastRequest = System.currentTimeMillis() - lastConferenceRequestReceived;
long timeout = ConferenceConfig.config.getConferenceStartTimeout().toMillis();
if (timeSinceLastRequest > 0 && timeSinceLastRequest < timeout)
{
logger.warn("Delaying stopping my " + timeout + " ms because of a recent conference request.");
TaskPools.getScheduledPool().schedule(this::maybeStop, timeout, TimeUnit.MILLISECONDS);
}
else
{
maybeStop();
}
}

/**
* Notify this instance that a conference request for it was received.
*/
public void conferenceRequestReceived()
{
lastConferenceRequestReceived = System.currentTimeMillis();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class ConferenceIqHandler(
logger.info("Conference request for room $room, from ${query.from}")
val conference = focusManager.getConference(room)
val roomExists = conference != null
conference?.conferenceRequestReceived()

// Authentication logic
val error: IQ? = processExtensions(query, room, response, roomExists)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class XMPPDomainAuthAuthorityTest : ShouldSpec() {
}

context("CASE 3: guest domain, no session-id, room exists") {
every { focusManager.getConference(any()) } returns mockk()
every { focusManager.getConference(any()) } returns mockk(relaxed = true)
val query = ConferenceIq().apply {
to = JidCreate.from("jicofo@example.com")
from = user2GuestJid
Expand Down Expand Up @@ -120,7 +120,7 @@ class XMPPDomainAuthAuthorityTest : ShouldSpec() {
}

context("CASE 5: guest jid, invalid session-id, room exists") {
every { focusManager.getConference(any()) } returns mockk()
every { focusManager.getConference(any()) } returns mockk(relaxed = true)
val query = ConferenceIq().apply {
room = room2
to = JidCreate.from("jicofo@example.com")
Expand All @@ -141,7 +141,7 @@ class XMPPDomainAuthAuthorityTest : ShouldSpec() {
}

context("CASE 6: do not allow to use session-id from different machine") {
every { focusManager.getConference(any()) } returns mockk()
every { focusManager.getConference(any()) } returns mockk(relaxed = true)
val query = ConferenceIq().apply {
room = room2
to = JidCreate.from("jicofo@example.com")
Expand All @@ -155,7 +155,7 @@ class XMPPDomainAuthAuthorityTest : ShouldSpec() {
}

context("CASE 7: auth jid, but stolen session id") {
every { focusManager.getConference(any()) } returns mockk()
every { focusManager.getConference(any()) } returns mockk(relaxed = true)
val query = ConferenceIq().apply {
room = room2
to = JidCreate.from("jicofo@example.com")
Expand All @@ -169,7 +169,7 @@ class XMPPDomainAuthAuthorityTest : ShouldSpec() {
}

context("CASE 8: guest jid, session used without machine UID") {
every { focusManager.getConference(any()) } returns mockk()
every { focusManager.getConference(any()) } returns mockk(relaxed = true)
val query = ConferenceIq().apply {
room = room2
to = JidCreate.from("jicofo@example.com")
Expand All @@ -183,7 +183,7 @@ class XMPPDomainAuthAuthorityTest : ShouldSpec() {
}

context("CASE 9: auth jid, try to create session without machine UID") {
every { focusManager.getConference(any()) } returns mockk()
every { focusManager.getConference(any()) } returns mockk(relaxed = true)
val query = ConferenceIq().apply {
to = JidCreate.from("jicofo@example.com")
type = IQ.Type.set
Expand All @@ -197,7 +197,7 @@ class XMPPDomainAuthAuthorityTest : ShouldSpec() {
}

context("CASE 10: same user, different machine UID - assign separate session") {
every { focusManager.getConference(any()) } returns mockk()
every { focusManager.getConference(any()) } returns mockk(relaxed = true)
val user3MachineUID = "user3machineUID"
val query = ConferenceIq().apply {
room = room3
Expand Down
Loading