-
Notifications
You must be signed in to change notification settings - Fork 119
Fix connection leaks: Ensure that any pending connection open are cancelled/undo when ActiveCall is unmounted #3255
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
Conversation
AudioCaptureOptions was a different object but with same internal values, use directly deviceId so that Object.is works properly
b529ebc
to
83c630c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good.
I think renaming would make sense. (If cancellable is from "able to cancel" its spelled wrong?)
src/livekit/useECConnectionState.ts
Outdated
// Protection against potential leaks, where the component to be unmounted and there is | ||
// still a pending doConnect promise. This would lead the user to still be in the call even | ||
// if the component is unmounted. | ||
const cancelBag = useRef(new Set<Cancellable>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abortHandles
?
{ | ||
deviceId: initialDevices.current.audioInput.selectedId, | ||
}, | ||
initialDevices.current.audioInput.selectedId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good that you detected and fixed this!
src/utils/cancellable.ts
Outdated
export class Cancellable { | ||
public constructor(private cancelled = false) {} | ||
|
||
public cancel(): void { | ||
this.cancelled = true; | ||
} | ||
|
||
public isCancelled(): boolean { | ||
return this.cancelled; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export class Cancellable { | |
public constructor(private cancelled = false) {} | |
public cancel(): void { | |
this.cancelled = true; | |
} | |
public isCancelled(): boolean { | |
return this.cancelled; | |
} | |
} | |
export class AbortHandle { | |
public constructor(private aborted = false) {} | |
public abort(): void { | |
this.aborted = true; | |
} | |
public isAborted(): boolean { | |
return this.aborted; | |
} | |
} |
a273f34
to
c33fa98
Compare
…celled/undo when ActiveCall is unmounted (#3255) * Better logs for connection/component lifecycle * fix: `AudioCaptureOptions` was causing un-necessary effect render AudioCaptureOptions was a different object but with same internal values, use directly deviceId so that Object.is works properly * fix: Livekit openned connection leaks * review: rename to AbortHandles * review: rename variable --------- Co-authored-by: Timo <[email protected]>
…celled/undo when ActiveCall is unmounted (#3255) (#3269) * Better logs for connection/component lifecycle * fix: `AudioCaptureOptions` was causing un-necessary effect render AudioCaptureOptions was a different object but with same internal values, use directly deviceId so that Object.is works properly * fix: Livekit openned connection leaks * review: rename to AbortHandles * review: rename variable --------- Co-authored-by: Valere Fedronic <[email protected]>
Fixes #3268