attempt to switch start event if we already have a verifier
This commit is contained in:
@@ -521,10 +521,18 @@ export class VerificationRequest extends EventEmitter {
|
||||
}
|
||||
// only pass events from the other side to the verifier,
|
||||
// no remote echos of our own events
|
||||
if (this._verifier && !isRemoteEcho && !this.observeOnly) {
|
||||
if (type === CANCEL_TYPE || (this._verifier.events
|
||||
&& this._verifier.events.includes(type))) {
|
||||
this._verifier.handleEvent(event);
|
||||
if (this._verifier && !this.observeOnly) {
|
||||
const oldEvent = this._verifier.startEvent;
|
||||
// if the verifier does not have a startEvent, it is because it's still sending and we are on the initator side
|
||||
const oldSender = oldEvent ? oldEvent.getSender() : this._client.getUserId();
|
||||
const newEventWinsRace = event.getSender() < oldSender;
|
||||
if (this._verifier.canSwitchStartEvent(event) && newEventWinsRace) {
|
||||
this._verifier.switchStartEvent(event);
|
||||
} else if (!isRemoteEcho) {
|
||||
if (type === CANCEL_TYPE || (this._verifier.events
|
||||
&& this._verifier.events.includes(type))) {
|
||||
this._verifier.handleEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user