8000 Mitigate event emitter "memory leak" warnings when a significant number of camera streaming events occur simultaneously. by hjdhjd · Pull Request #1037 · homebridge/HAP-NodeJS · GitHub
[go: up one dir, main page]

Skip to content

Mitigate event emitter "memory leak" warnings when a significant number of camera streaming events occur simultaneously. #1037

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

Merged
merged 1 commit into from
Jun 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Mitigate event emitter "memory leak" warnings when a significant numb…
…er of HomeKit camera streaming events occur simultaneously.
  • Loading branch information
hjdhjd committed Jun 16, 2024
commit 97976b8874bb47c67620c3bac92c18bb393649c0
2 changes: 2 additions & 0 deletions src/lib/camera/RTPStreamManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ export class RTPStreamManagement {

if (this.activeConnection) {
this.activeConnection.removeListener(HAPConnectionEvent.CLOSED, this.activeConnectionClosedListener);
this.activeConnection.setMaxListeners(this.activeConnection.getMaxListeners() - 1);
this.activeConnection = undefined;
}

Expand Down Expand Up @@ -1098,6 +1099,7 @@ export class RTPStreamManagement {
"Found non-nil `activeConnection` when trying to setup streaming endpoints, even though streamStatus is reported to be AVAILABLE!");

this.activeConnection = connection;
this.activeConnection.setMaxListeners(this.activeConnection.getMaxListeners() + 1);
this.activeConnection.on(HAPConnectionEvent.CLOSED, this.activeConnectionClosedListener);

// noinspection JSDeprecatedSymbols
Expand Down
Loading
0