Skip to content

Commit

Permalink
versatica#556. RTCSession. Emit private '_failed' event before closing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan authored and lcl987512 committed Aug 21, 2020
1 parent 516f445 commit 4ccb432
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/RTCSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,7 @@ module.exports = class RTCSession extends EventEmitter
notifier.notify(response.status_code, response.reason_phrase);
});

session.on('failed', ({ message, cause }) =>
session.on('_failed', ({ message, cause }) =>
{
if (message)
{
Expand Down Expand Up @@ -3438,6 +3438,15 @@ module.exports = class RTCSession extends EventEmitter
{
debug('session failed');

// Emit private '_failed' event first.
debug('emit "_failed"');

this.emit('_failed', {
originator,
message : message || null,
cause
});

this._close();

debug('emit "failed"');
Expand Down

0 comments on commit 4ccb432

Please sign in to comment.