Skip to content

Commit

Permalink
Only send event if stream is not closed (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
njooma authored Oct 3, 2023
1 parent 123abaf commit 2d7dbea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/src/media/stream/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class StreamClient {
_internalListener.pause();
await _close(name);
_stream = null;
_streamController.add(null);
if (!_streamController.isClosed) _streamController.add(null);
}
}
}
7 changes: 6 additions & 1 deletion lib/src/robot/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ class RobotClient {
try {
_checkConnectionTask?.cancel();
_shouldAttemptReconnection = false;
await _streamManager.closeAll();
try {
await _streamManager.closeAll();
} catch (_) {
// Do nothing -- we don't care if this fails,
// the server should clean up disconnected streams automatically.
}
_sessionsClient.stop();
await _channel.shutdown();
} catch (e) {
Expand Down

0 comments on commit 2d7dbea

Please sign in to comment.