Browse Source

InputStreams should be disposed when destroyed

tags/1.0-rc
RogueException 8 years ago
parent
commit
d991834c50
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      src/Discord.Net.WebSocket/Audio/AudioClient.cs

+ 5
- 2
src/Discord.Net.WebSocket/Audio/AudioClient.cs View File

@@ -183,15 +183,18 @@ namespace Discord.Audio
}
internal async Task RemoveInputStreamAsync(ulong userId)
{
if (_streams.TryRemove(userId, out var ignored))
if (_streams.TryRemove(userId, out var pair))
{
await _streamDestroyedEvent.InvokeAsync(userId).ConfigureAwait(false);
pair.Reader.Dispose();
}
}
internal async Task ClearInputStreamsAsync()
{
foreach (var pair in _streams)
{
pair.Value.Reader.Dispose();
await _streamDestroyedEvent.InvokeAsync(pair.Key).ConfigureAwait(false);
pair.Value.Reader.Dispose();
}
_ssrcMap.Clear();
_streams.Clear();


Loading…
Cancel
Save