mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-20 16:00:29 +00:00
Actually read from the voice websocket & fix heartbeat.
This change makes it so that the buffer doesn't fill and the voice server drops the socket. Also, use correct interval for voice websocket heartbeat.
This commit is contained in:
parent
b9c7b05176
commit
41a2b5ed73
@ -549,7 +549,7 @@ class DiscordVoiceWebSocket(websockets.client.WebSocketClientProtocol):
|
||||
data = msg.get('d')
|
||||
|
||||
if op == self.READY:
|
||||
interval = (data['heartbeat_interval'] / 100.0) - 5
|
||||
interval = data['heartbeat_interval'] / 1000.0
|
||||
self._keep_alive = VoiceKeepAliveHandler(ws=self, interval=interval)
|
||||
self._keep_alive.start()
|
||||
yield from self.initial_connection(data)
|
||||
|
@ -225,6 +225,16 @@ class VoiceClient:
|
||||
self._connected.set()
|
||||
break
|
||||
|
||||
self.loop.create_task(self.poll_voice_ws())
|
||||
|
||||
@asyncio.coroutine
|
||||
def poll_voice_ws(self):
|
||||
"""|coro|
|
||||
Reads from the voice websocket while connected.
|
||||
"""
|
||||
while self._connected.is_set():
|
||||
yield from self.ws.poll_event()
|
||||
|
||||
@asyncio.coroutine
|
||||
def disconnect(self):
|
||||
"""|coro|
|
||||
|
Loading…
x
Reference in New Issue
Block a user