Skip to content

Commit 6a8ee11

Browse files
Lulalabypre-commit-ci[bot]BobDotCom
committed
fix: ip discovery changes (74 byte udp packets) (#1955)
* fix: ip discovery changes (74 byte udp packets) * chore: Pr will be 1955 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update CHANGELOG.md Signed-off-by: Lala Sabathil <aiko@aitsys.dev> * Update CHANGELOG.md Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com> Signed-off-by: Lala Sabathil <aiko@aitsys.dev> --------- Signed-off-by: Lala Sabathil <aiko@aitsys.dev> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com>
1 parent d298f43 commit 6a8ee11

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ These changes are available on the `master` branch, but have not yet been releas
2020

2121
- Fixed the type-hinting of `SlashCommandGroup.walk_commands()` to reflect actual
2222
behavior. ([#1852](https://github.com/Pycord-Development/pycord/pull/1852))
23+
- Fixed the voice ip discovery due to the recent
24+
[announced change](https://discord.com/channels/613425648685547541/697138785317814292/1080623873629884486).
25+
([#1955](https://github.com/Pycord-Development/pycord/pull/1955))
2326

2427
## [2.4.0] - 2023-02-10
2528

discord/gateway.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -892,16 +892,16 @@ async def initial_connection(self, data):
892892
state.voice_port = data["port"]
893893
state.endpoint_ip = data["ip"]
894894

895-
packet = bytearray(70)
895+
packet = bytearray(74)
896896
struct.pack_into(">H", packet, 0, 1) # 1 = Send
897897
struct.pack_into(">H", packet, 2, 70) # 70 = Length
898898
struct.pack_into(">I", packet, 4, state.ssrc)
899899
state.socket.sendto(packet, (state.endpoint_ip, state.voice_port))
900-
recv = await self.loop.sock_recv(state.socket, 70)
900+
recv = await self.loop.sock_recv(state.socket, 74)
901901
_log.debug("received packet in initial_connection: %s", recv)
902902

903-
# the ip is ascii starting at the 4th byte and ending at the first null
904-
ip_start = 4
903+
# the ip is ascii starting at the 8th byte and ending at the first null
904+
ip_start = 8
905905
ip_end = recv.index(0, ip_start)
906906
state.ip = recv[ip_start:ip_end].decode("ascii")
907907

0 commit comments

Comments
 (0)