Skip to content

Conversation

@danxuliu
Copy link
Member

@danxuliu danxuliu commented Feb 8, 2023

Fixes #8626

Self-joined users are just temporary participants and they need to be removed when they leave a conversation. However, this needs to be done once they have no more sessions in that conversation; otherwise the remaining sessions would be kicked out from the conversation as soon as one leaves it.

Moreover, if the external signaling server is used, when a participant is disinvited it is expected that the client leaves the conversation if still in it. Therefore, self-joined users should not be disinvited when
they disconnect from a conversation, as they can still have other sessions in it.

To ensure that self-joined users will be disinvited when their last session leaves the conversation now a USER_REMOVE event is explicitly triggered when that last session leaves and the user is, in fact, removed from the conversation.

Note that this does not cause the system message about the participant leaving to be sent, as it is explicitly guarded against self-joined users leaving the conversation. However, this change will cause other handlers to be called now, like those to invalidate resources, but it is very likely that they should have been called and that this change is actually a fix too in that regard.

It would be great to add integration tests to explicitly check this, but I do not if it is possible to simulate different sessions for the same participant in the integration tests.

Self-joined users are just temporary participants and they need to be
removed when they leave a conversation. However, this needs to be done
once they have no more sessions in that conversation; otherwise the
remaining sessions would be kicked out from the conversation as soon as
one leaves it.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@danxuliu
Copy link
Member Author

danxuliu commented Feb 8, 2023

/backport to stable25

@danxuliu
Copy link
Member Author

danxuliu commented Feb 8, 2023

/backport to stable24

$this->dispatcher->dispatchTyped($attendeeEvent);
}
if ($participant->getAttendee()->getParticipantType() === Participant::USER_SELF_JOINED
&& empty($this->sessionMapper->findByAttendeeId($participant->getAttendee()->getId()))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: Can skip this query when we did the deleteByAttendeeId above, but might not have a big impact

@nickvergessen
Copy link
Member

Unit tests are not happy.


On that note, integration tests would be awesome, but I know they don't work at the moment with multiple sessions, so something to be raised again later.

If the external signaling server is used, when a participant is
disinvited it is expected that the client leaves the conversation if
still in it. Therefore, self-joined users should not be disinvited when
they disconnect from a conversation, as they can still have other
sessions in it.

To ensure that self-joined users will be disinvited when their last
session leaves the conversation now a USER_REMOVE event is explicitly
triggered when that last session leaves and the user is, in fact,
removed from the conversation.

Note that this does not cause the system message about the participant
leaving to be sent, as it is explicitly guarded against self-joined
users leaving the conversation. However, this change will cause other
handlers to be called now, like those to invalidate resources, but it is
very likely that they should have been called and that this change is
actually a fix too in that regard.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
This should not make any difference in the behaviour, but it looks more
correct to first disconnect and then remove than the other way around.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@danxuliu danxuliu force-pushed the fix-leaving-room-as-a-self-joined-user-with-several-sessions branch from e7d0842 to b82cc23 Compare February 8, 2023 23:16
@danxuliu
Copy link
Member Author

danxuliu commented Feb 8, 2023

Unit tests are not happy.

Fixed.

Copy link
Contributor

@vitormattos vitormattos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be necessary backport?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-session not working with self-joined users

4 participants