Better handling of VOICE_SERVER_UPDATE.

This now sort of respects "Awaiting Endpoint..." waiting. I haven't
actually tested out this case since it's hard to get it. However this
new code does work with the regular connection flow.
This commit is contained in:
Rapptz
2017-04-18 19:05:34 -04:00
parent b4bc4dfd12
commit f9c2ac9d25
3 changed files with 34 additions and 29 deletions

View File

@ -796,7 +796,7 @@ class Callable(metaclass=abc.ABCMeta):
raise NotImplementedError
@asyncio.coroutine
def connect(self, *, timeout=10.0, reconnect=True):
def connect(self, *, timeout=60.0, reconnect=True):
"""|coro|
Connects to voice and creates a :class:`VoiceClient` to establish
@ -805,8 +805,7 @@ class Callable(metaclass=abc.ABCMeta):
Parameters
-----------
timeout: float
The timeout in seconds to wait for the
initial handshake to be completed.
The timeout in seconds to wait for the voice endpoint.
reconnect: bool
Whether the bot should automatically attempt
a reconnect if a part of the handshake fails
@ -833,6 +832,7 @@ class Callable(metaclass=abc.ABCMeta):
raise ClientException('Already connected to a voice channel.')
voice = VoiceClient(state=state, timeout=timeout, channel=self)
state._add_voice_client(key_id, voice)
try:
yield from voice.connect(reconnect=reconnect)
@ -844,5 +844,4 @@ class Callable(metaclass=abc.ABCMeta):
pass
raise e # re-raise
state._add_voice_client(key_id, voice)
return voice