Update ip discovery to send 74 bytes (#2617)
This commit is contained in:
@@ -306,7 +306,7 @@ namespace Discord.Audio
|
|||||||
{
|
{
|
||||||
if (_connection.State == ConnectionState.Connecting)
|
if (_connection.State == ConnectionState.Connecting)
|
||||||
{
|
{
|
||||||
if (packet.Length != 70)
|
if (packet.Length != 74)
|
||||||
{
|
{
|
||||||
await _audioLogger.DebugAsync("Malformed Packet").ConfigureAwait(false);
|
await _audioLogger.DebugAsync("Malformed Packet").ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
@@ -315,8 +315,8 @@ namespace Discord.Audio
|
|||||||
int port;
|
int port;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ip = Encoding.UTF8.GetString(packet, 4, 70 - 6).TrimEnd('\0');
|
ip = Encoding.UTF8.GetString(packet, 8, 74 - 10).TrimEnd('\0');
|
||||||
port = (packet[69] << 8) | packet[68];
|
port = (packet[73] << 8) | packet[72];
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -228,12 +228,14 @@ namespace Discord.Audio
|
|||||||
#region Udp
|
#region Udp
|
||||||
public async Task SendDiscoveryAsync(uint ssrc)
|
public async Task SendDiscoveryAsync(uint ssrc)
|
||||||
{
|
{
|
||||||
var packet = new byte[70];
|
var packet = new byte[74];
|
||||||
packet[0] = (byte)(ssrc >> 24);
|
packet[1] = 1;
|
||||||
packet[1] = (byte)(ssrc >> 16);
|
packet[3] = 70;
|
||||||
packet[2] = (byte)(ssrc >> 8);
|
packet[4] = (byte)(ssrc >> 24);
|
||||||
packet[3] = (byte)(ssrc >> 0);
|
packet[5] = (byte)(ssrc >> 16);
|
||||||
await SendAsync(packet, 0, 70).ConfigureAwait(false);
|
packet[6] = (byte)(ssrc >> 8);
|
||||||
|
packet[7] = (byte)(ssrc >> 0);
|
||||||
|
await SendAsync(packet, 0, 74).ConfigureAwait(false);
|
||||||
await _sentDiscoveryEvent.InvokeAsync().ConfigureAwait(false);
|
await _sentDiscoveryEvent.InvokeAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
public async Task<ulong> SendKeepaliveAsync()
|
public async Task<ulong> SendKeepaliveAsync()
|
||||||
|
|||||||
Reference in New Issue
Block a user