Skip to content

Commit

Permalink
Remove empty decryption listener (#2486)
Browse files Browse the repository at this point in the history
* Remove empty decryption listener

This listener looks like it was left over from something as it just
did nothing at all. The todevice event gets put into the call
event buffer which awaits on decryption for each event before
processing, so it should already wait for decryption.

More info: element-hq/element-call#428

* Unused import

* Unused function!
  • Loading branch information
dbkr authored Jul 1, 2022
1 parent ca5ac79 commit 6ea2885
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/webrtc/callEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { MatrixEvent, MatrixEventEvent } from '../models/event';
import { MatrixEvent } from '../models/event';
import { logger } from '../logger';
import { CallDirection, CallErrorCode, CallState, createNewMatrixCall, MatrixCall } from './call';
import { EventType } from '../@types/event';
Expand Down Expand Up @@ -140,13 +140,6 @@ export class CallEventHandler {
this.nextSeqByCall.set(content.call_id, 0);
}

if (event.isBeingDecrypted() || event.isDecryptionFailure()) {
// add an event listener for once the event is decrypted.
event.once(MatrixEventEvent.Decrypted, async () => {
if (!this.eventIsACall(event)) return;
});
}

if (content.seq === undefined) {
this.callEventBuffer.push(event);
return;
Expand Down Expand Up @@ -184,15 +177,6 @@ export class CallEventHandler {
}
};

private eventIsACall(event: MatrixEvent): boolean {
const type = event.getType();
/**
* Unstable prefixes:
* - org.matrix.call. : MSC3086 https://github.com/matrix-org/matrix-doc/pull/3086
*/
return type.startsWith("m.call.") || type.startsWith("org.matrix.call.");
}

private async handleCallEvent(event: MatrixEvent) {
this.client.emit(ClientEvent.ReceivedVoipEvent, event);

Expand Down

0 comments on commit 6ea2885

Please sign in to comment.