mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-16 18:59:09 +00:00
fix broken ip and port in voice client
Also added debug logging to make it easier to debug errors in how the initial packet is parsed.
This commit is contained in:
parent
ac3e583b05
commit
57c3363119
@ -210,16 +210,18 @@ class VoiceClient:
|
||||
struct.pack_into('>I', packet, 0, self.ssrc)
|
||||
self.socket.sendto(packet, (self.endpoint_ip, self.voice_port))
|
||||
recv = yield from self.loop.sock_recv(self.socket, 70)
|
||||
self.ip = []
|
||||
log.debug('received packet in initial_connection: {}'.format(recv))
|
||||
ip = []
|
||||
|
||||
for x in range(4, len(recv)):
|
||||
val = recv[x]
|
||||
if val == 0:
|
||||
break
|
||||
self.ip.append(str(val))
|
||||
ip.append(chr(val))
|
||||
|
||||
self.ip = '.'.join(self.ip)
|
||||
self.port = recv[len(recv) - 2] << 0 | recv[len(recv) - 1] << 1
|
||||
self.ip = ''.join(ip)
|
||||
self.port = recv[len(recv) - 2] | recv[len(recv) - 1] << 8
|
||||
log.debug('detected ip: {} port: {}'.format(self.ip, self.port))
|
||||
|
||||
payload = {
|
||||
'op': 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user