Skip to content

Commit

Permalink
properly reject promises and remove clientId from pendingMediaRequest…
Browse files Browse the repository at this point in the history
…s Map when the participant disconnect
  • Loading branch information
vincentfretin committed Mar 11, 2022
1 parent aea662a commit ec505fb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/adapters/EasyRtcAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ class EasyRtcAdapter extends NoOpAdapter {

this.easyrtc.setPeerClosedListener((clientId) => {
delete this.remoteClients[clientId];
const pendingMediaRequests = this.pendingMediaRequests.get(clientId);
if (pendingMediaRequests) {
const msg = "The user disconnected before the media stream was resolved.";
Object.keys(pendingMediaRequests).forEach((streamName) => {
pendingMediaRequests[streamName].reject(msg);
});
this.pendingMediaRequests.delete(clientId);
}
});
}

Expand Down

0 comments on commit ec505fb

Please sign in to comment.