Skip to content

Commit dc1a586

Browse files
committed
fix(voice): Update ip-discovery to use 74-byte package according to https://canary.discord.com/channels/613425648685547541/697138785317814292/1080623873629884486
1 parent 74d4b72 commit dc1a586

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

discord/gateway.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -898,16 +898,16 @@ async def initial_connection(self, data):
898898
state.voice_port = data['port']
899899
state.endpoint_ip = data['ip']
900900

901-
packet = bytearray(70)
902-
struct.pack_into('>H', packet, 0, 1) # 1 = Send
903-
struct.pack_into('>H', packet, 2, 70) # 70 = Length
901+
packet = bytearray(74)
902+
struct.pack_into('>H', packet, 0, 1) # 1 = Send
903+
struct.pack_into('>H', packet, 2, 70) # 70 = Length
904904
struct.pack_into('>I', packet, 4, state.ssrc)
905905
state.socket.sendto(packet, (state.endpoint_ip, state.voice_port))
906-
recv = await self.loop.sock_recv(state.socket, 70)
906+
recv = await self.loop.sock_recv(state.socket, 74)
907907
log.debug('received packet in initial_connection: %s', recv)
908908

909-
# the ip is ascii starting at the 4th byte and ending at the first null
910-
ip_start = 4
909+
# the ip is ascii starting at the 8th byte and ending at the first null
910+
ip_start = 8
911911
ip_end = recv.index(0, ip_start)
912912
state.ip = recv[ip_start:ip_end].decode('ascii')
913913

0 commit comments

Comments
 (0)