mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-01 07:40:07 +00:00
Fix udp discovery not using 74 byte layout
This commit is contained in:
parent
53ce47534d
commit
6910943703
@ -948,16 +948,16 @@ class DiscordVoiceWebSocket:
|
|||||||
state.voice_port = data['port']
|
state.voice_port = data['port']
|
||||||
state.endpoint_ip = data['ip']
|
state.endpoint_ip = data['ip']
|
||||||
|
|
||||||
packet = bytearray(70)
|
packet = bytearray(74)
|
||||||
struct.pack_into('>H', packet, 0, 1) # 1 = Send
|
struct.pack_into('>H', packet, 0, 1) # 1 = Send
|
||||||
struct.pack_into('>H', packet, 2, 70) # 70 = Length
|
struct.pack_into('>H', packet, 2, 70) # 70 = Length
|
||||||
struct.pack_into('>I', packet, 4, state.ssrc)
|
struct.pack_into('>I', packet, 4, state.ssrc)
|
||||||
state.socket.sendto(packet, (state.endpoint_ip, state.voice_port))
|
state.socket.sendto(packet, (state.endpoint_ip, state.voice_port))
|
||||||
recv = await self.loop.sock_recv(state.socket, 70)
|
recv = await self.loop.sock_recv(state.socket, 74)
|
||||||
_log.debug('received packet in initial_connection: %s', recv)
|
_log.debug('received packet in initial_connection: %s', recv)
|
||||||
|
|
||||||
# the ip is ascii starting at the 4th byte and ending at the first null
|
# the ip is ascii starting at the 8th byte and ending at the first null
|
||||||
ip_start = 4
|
ip_start = 8
|
||||||
ip_end = recv.index(0, ip_start)
|
ip_end = recv.index(0, ip_start)
|
||||||
state.ip = recv[ip_start:ip_end].decode('ascii')
|
state.ip = recv[ip_start:ip_end].decode('ascii')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user