added caching to lol commands

This commit is contained in:
Master Kwoth
2016-02-24 06:32:01 +01:00
parent a44c3e5e7b
commit 135d76719d
3 changed files with 61 additions and 6 deletions

View File

@ -191,6 +191,7 @@ namespace NadekoBot.Classes.Music {
if (State == StreamState.Completed) {
Console.WriteLine("Buffering canceled, stream is completed.");
p.CancelOutputRead();
p.Close();
return;
}
@ -215,6 +216,7 @@ namespace NadekoBot.Classes.Music {
if (read == 0) {
if (attempt == 5) {
Console.WriteLine($"Didn't read anything from the stream for {attempt} attempts. {buffer.Length / 1.MB()}MB length");
p.CancelOutputRead();
p.Close();
return;
}
@ -235,6 +237,7 @@ namespace NadekoBot.Classes.Music {
catch { }
finally {
if (p != null) {
p.CancelOutputRead();
p.Close();
p.Dispose();
p = null;