Fixed voice errors

This commit is contained in:
RogueException
2015-10-19 02:38:23 -03:00
parent 0aae3fe3a0
commit 7b036446a2
2 changed files with 8 additions and 2 deletions

View File

@@ -21,7 +21,7 @@
private bool _ackMessages = false;
//Internal
internal override bool EnableVoice => base.EnableVoice && !EnableVoiceMultiserver;
internal override bool EnableVoice => (base.EnableVoice && !EnableVoiceMultiserver) || base.VoiceOnly;
public new DiscordClientConfig Clone()
{

View File

@@ -32,6 +32,9 @@ namespace Discord.Net.Voice
public void Push(byte[] buffer, int bytes, CancellationToken cancelToken)
{
if (cancelToken.IsCancellationRequested)
throw new OperationCanceledException("Client is disconnected.", cancelToken);
int wholeFrames = bytes / _frameSize;
int expectedBytes = wholeFrames * _frameSize;
int lastFrameSize = bytes - expectedBytes;
@@ -50,7 +53,10 @@ namespace Discord.Net.Voice
{
_notOverflowEvent.Wait(cancelToken);
}
catch (OperationCanceledException) { return; }
catch (OperationCanceledException ex)
{
throw new OperationCanceledException("Client is disconnected.", ex, cancelToken);
}
}
if (i == wholeFrames)