1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00

Resolve races between initLocalCallFeed and leave

Unfortunately there are still other methods that could race with leave and result in broken group call state, such as enter and terminate. For the future, should consider writing a more careful specification of how the whole group call state machine is meant to work.
This commit is contained in:
Robin Townsend
2022-10-31 12:08:19 -04:00
parent f0d4ef7f99
commit b9cccf9109
2 changed files with 21 additions and 1 deletions

View File

@ -23,7 +23,7 @@ import {
Room,
RoomMember,
} from '../../../src';
import { GroupCall, GroupCallEvent } from "../../../src/webrtc/groupCall";
import { GroupCall, GroupCallEvent, GroupCallState } from "../../../src/webrtc/groupCall";
import { MatrixClient } from "../../../src/client";
import {
installWebRTCMocks,
@ -174,6 +174,13 @@ describe('Group Call', function() {
groupCall.leave();
});
it("stops initializing local call feed when leaving", async () => {
const initPromise = groupCall.initLocalCallFeed();
groupCall.leave();
await expect(initPromise).rejects.toBeDefined();
expect(groupCall.state).toBe(GroupCallState.LocalCallFeedUninitialized);
});
it("sends state event to room when creating", async () => {
await groupCall.create();