diff options
| author | Lorenzo <[email protected]> | 2019-12-06 19:33:15 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-12-06 19:33:15 +0100 |
| commit | 1b9108ffd75fb257b699d1af41f0b9c22fc04a97 (patch) | |
| tree | 30f7c69bbedb8628ea1bd913ac41cf373b9cd4f6 | |
| parent | Return 'username' instead of 'name' (diff) | |
| download | discord.py-1b9108ffd75fb257b699d1af41f0b9c22fc04a97.tar.xz discord.py-1b9108ffd75fb257b699d1af41f0b9c22fc04a97.zip | |
The port is a big endian unsigned short.
See https://github.com/discordapp/discord-api-docs/pull/1244
| -rw-r--r-- | discord/gateway.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/discord/gateway.py b/discord/gateway.py index 21f4fc66..13ea85b7 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -721,9 +721,7 @@ class DiscordVoiceWebSocket(websockets.client.WebSocketClientProtocol): ip_end = recv.index(0, ip_start) state.ip = recv[ip_start:ip_end].decode('ascii') - # the port is a little endian unsigned short in the last two bytes - # yes, this is different endianness from everything else - state.port = struct.unpack_from('<H', recv, len(recv) - 2)[0] + state.port = struct.unpack_from('>H', recv, len(recv) - 2)[0] log.debug('detected ip: %s port: %s', state.ip, state.port) # there *should* always be at least one supported mode (xsalsa20_poly1305) |