Skip to content

Commit 5872b53

Browse files
authored
fix bug in handleParticipantDisconnect. (#499)
1 parent 3adcfc7 commit 5872b53

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/src/core/room.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -555,10 +555,8 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
555555

556556
final isNew = !_remoteParticipants.containsKey(info.identity);
557557

558-
if (info.state == lk_models.ParticipantInfo_State.DISCONNECTED &&
559-
!isNew) {
560-
hasChanged = true;
561-
await _handleParticipantDisconnect(info.identity);
558+
if (info.state == lk_models.ParticipantInfo_State.DISCONNECTED) {
559+
hasChanged = await _handleParticipantDisconnect(info.identity);
562560
continue;
563561
}
564562

@@ -697,15 +695,16 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
697695
events.emit(event);
698696
}
699697

700-
Future<void> _handleParticipantDisconnect(String identity) async {
698+
Future<bool> _handleParticipantDisconnect(String identity) async {
701699
final participant = _remoteParticipants.remove(identity);
702700
if (participant == null) {
703-
return;
701+
return false;
704702
}
705703

706704
await participant.removeAllPublishedTracks(notify: true);
707705

708706
emitWhenConnected(ParticipantDisconnectedEvent(participant: participant));
707+
return true;
709708
}
710709

711710
Future<void> _sendSyncState() async {

0 commit comments

Comments
 (0)