@@ -315,46 +315,51 @@ class RtcController extends EventEmitter {
315
315
terminateByOwner ( ownerId ) {
316
316
log . debug ( `terminateByOwner ${ ownerId } ` ) ;
317
317
const terminations = [ ] ;
318
- // Or just destroy the transport
318
+ const transports = new Set ( ) ;
319
319
this . operations . forEach ( ( operation , operationId ) => {
320
320
const transport = this . transports . get ( operation . transportId ) ;
321
321
if ( transport . owner === ownerId ) {
322
322
const p = this . terminate ( operationId , operation . direction , 'Owner leave' ) ;
323
323
terminations . push ( p ) ;
324
+ transports . add ( transport . id ) ;
324
325
}
325
326
} ) ;
326
- return Promise . all ( terminations ) ;
327
+ return Promise . all ( terminations ) . then ( ( ) => {
328
+ transports . forEach ( ( transportId ) => {
329
+ const status = { type : 'failed' , reason : 'Owner leave' } ;
330
+ this . onTransportProgress ( transportId , status ) ;
331
+ } ) ;
332
+ } ) ;
327
333
} ;
328
334
329
335
terminateByLocality ( type , id ) {
330
336
log . debug ( `terminateByLocality ${ type } ${ id } ` ) ;
331
337
const terminations = [ ] ;
332
- // Or just destroy the transport
338
+ const transports = new Set ( ) ;
333
339
this . operations . forEach ( ( operation , operationId ) => {
334
340
const l = this . transports . get ( operation . transportId ) . locality ;
335
- if ( l ) {
336
- if ( ( type === 'worker' && l . agent === id ) ||
337
- ( type === 'node' && l . node === id ) ) {
338
- const p = this . terminate ( operationId , operation . direction , 'Node lost' ) ;
339
- terminations . push ( p ) ;
340
- }
341
+ if ( l && ( ( type === 'worker' && l . agent === id ) ||
342
+ ( type === 'node' && l . node === id ) ) ) {
343
+ const p = this . terminate ( operationId , operation . direction , 'Node lost' ) ;
344
+ terminations . push ( p ) ;
345
+ transports . add ( operation . transportId ) ;
341
346
}
342
347
} ) ;
343
- return Promise . all ( terminations ) ;
348
+ return Promise . all ( terminations ) . then ( ( ) => {
349
+ transports . forEach ( ( transportId ) => {
350
+ const status = { type : 'failed' , reason : 'Owner leave' } ;
351
+ this . onTransportProgress ( transportId , status ) ;
352
+ } ) ;
353
+ } ) ;
344
354
} ;
345
355
346
- onFaultDetected ( type , id ) {
347
-
348
- }
349
-
350
356
destroy ( ) {
351
357
log . debug ( `destroy` ) ;
352
- const terminations = [ ] ;
353
358
// Destroy all transports
354
359
this . transports . forEach ( ( transport , transportId ) => {
355
- const p = this . rpcReq . destroyTransport ( transportId ) ;
360
+ const status = { type : 'failed' , reason : 'Owner leave' } ;
361
+ this . onTransportProgress ( transportId , status ) ;
356
362
} ) ;
357
- return Promise . all ( terminations ) ;
358
363
} ;
359
364
360
365
setMute ( sessionId , tracks , muted ) {
0 commit comments