Skip to content

Commit

Permalink
#556. RTCSession. Emit private '_failed' event before closing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan committed Dec 24, 2018
1 parent 61242db commit e3fdf42
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 e3fdf42

Please sign in to comment.