-
Notifications
You must be signed in to change notification settings - Fork 1
[PB-5724] Cleanup the webworkers #103
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
| dispose() { | ||
| this._olmAdapter.clearMySession(); | ||
| this.clearAllSessions(); | ||
| this.conference.off( | ||
| JitsiConferenceEvents.USER_JOINED, | ||
| this._onParticipantJoined.bind(this), | ||
| ); | ||
| this.conference.off( | ||
| JitsiConferenceEvents.USER_LEFT, | ||
| this._onParticipantLeft.bind(this), | ||
| ); | ||
| this.conference.off( | ||
| JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, | ||
| this._onEndpointMessageReceived.bind(this), | ||
| ); | ||
| this.conference.off( | ||
| JitsiConferenceEvents.CONFERENCE_LEFT, | ||
| this._onConferenceLeft.bind(this), | ||
| ); | ||
| this.conference.off(JitsiConferenceEvents.CONFERENCE_JOINED, this.onConferenceJoined.bind(this)); | ||
| this.conference.off( | ||
| JitsiConferenceEvents._MEDIA_SESSION_STARTED, | ||
| this._onMediaSessionStarted.bind(this), | ||
| ); | ||
| this.conference.off( | ||
| JitsiConferenceEvents.TRACK_ADDED, | ||
| this.onTrackAddedHandler.bind(this), | ||
| ); | ||
| this.conference.rtc.off( | ||
| RTCEvents.REMOTE_TRACK_ADDED, | ||
| this.onRemoteTrackAddedHandler.bind(this), | ||
| ); | ||
| this.conference.off( | ||
| JitsiConferenceEvents.TRACK_MUTE_CHANGED, | ||
| this._trackMuteChanged.bind(this), | ||
| ); | ||
| this.e2eeCtx.off('sasUpdated', this.sasUpdatedHandler); | ||
| this.e2eeCtx.dispose(); | ||
| this._reqs.clear(); | ||
| this.update.clear(); | ||
| } |
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.
The dispose() listener removal won't work due to .bind(this) creating new function references.
EventEmitter.removeListener() compares by reference. Each .bind(this) call creates a new function object, so the references passed to off() in dispose() don't match the ones registered with on() in the constructor and the listeners silently remain attached
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.
oh, ok. Do you know how to remove .bind(this) listeners?
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.
create and keep reference in the class?
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.
Done :)
Description
When the connection fails due to a server or WebSocket error, several instances of web workers are created.

If the conference fails, it should clean up web workers, too
How Has This Been Tested?
During a call, switch from wi-fi to mobile internet to cause webSocket closed error. Or test when server is busy and terminates connections
Types of changes
Checklist: