Wait for the encryption key before returning from VoiceSocket.WaitForConnection()
This commit is contained in:
@@ -26,7 +26,6 @@ namespace Discord.WebSockets.Voice
|
|||||||
private readonly int _targetAudioBufferLength;
|
private readonly int _targetAudioBufferLength;
|
||||||
private OpusEncoder _encoder;
|
private OpusEncoder _encoder;
|
||||||
private readonly ConcurrentDictionary<uint, OpusDecoder> _decoders;
|
private readonly ConcurrentDictionary<uint, OpusDecoder> _decoders;
|
||||||
private ManualResetEventSlim _connectWaitOnLogin;
|
|
||||||
private uint _ssrc;
|
private uint _ssrc;
|
||||||
private ConcurrentDictionary<uint, string> _ssrcMapping;
|
private ConcurrentDictionary<uint, string> _ssrcMapping;
|
||||||
|
|
||||||
@@ -50,7 +49,6 @@ namespace Discord.WebSockets.Voice
|
|||||||
: base(client)
|
: base(client)
|
||||||
{
|
{
|
||||||
_rand = new Random();
|
_rand = new Random();
|
||||||
_connectWaitOnLogin = new ManualResetEventSlim(false);
|
|
||||||
_decoders = new ConcurrentDictionary<uint, OpusDecoder>();
|
_decoders = new ConcurrentDictionary<uint, OpusDecoder>();
|
||||||
_sendQueue = new ConcurrentQueue<byte[]>();
|
_sendQueue = new ConcurrentQueue<byte[]>();
|
||||||
_sendQueueWait = new ManualResetEventSlim(true);
|
_sendQueueWait = new ManualResetEventSlim(true);
|
||||||
@@ -247,8 +245,6 @@ namespace Discord.WebSockets.Voice
|
|||||||
int port = packet[68] | packet[69] << 8;
|
int port = packet[68] | packet[69] << 8;
|
||||||
string ip = Encoding.ASCII.GetString(packet, 4, 70 - 6).TrimEnd('\0');
|
string ip = Encoding.ASCII.GetString(packet, 4, 70 - 6).TrimEnd('\0');
|
||||||
|
|
||||||
EndConnect();
|
|
||||||
|
|
||||||
var login2 = new Login2Command();
|
var login2 = new Login2Command();
|
||||||
login2.Payload.Protocol = "udp";
|
login2.Payload.Protocol = "udp";
|
||||||
login2.Payload.SocketData.Address = ip;
|
login2.Payload.SocketData.Address = ip;
|
||||||
@@ -503,7 +499,7 @@ namespace Discord.WebSockets.Voice
|
|||||||
var payload = (msg.Payload as JToken).ToObject<JoinServerEvent>();
|
var payload = (msg.Payload as JToken).ToObject<JoinServerEvent>();
|
||||||
_secretKey = payload.SecretKey;
|
_secretKey = payload.SecretKey;
|
||||||
SendIsTalking(true);
|
SendIsTalking(true);
|
||||||
_connectWaitOnLogin.Set();
|
EndConnect();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
|||||||
Reference in New Issue
Block a user