From fe3b917564b5a9b5afe338fd594893d4c7c05f80 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 25 Jul 2017 20:00:00 -0400 Subject: [PATCH] Continue connection loop with back-off if connecting fails >5 times. --- discord/voice_client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/discord/voice_client.py b/discord/voice_client.py index 796eabc9e..fe89d62a5 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -245,7 +245,12 @@ class VoiceClient: self._connected.clear() yield from asyncio.sleep(retry, loop=self.loop) yield from self.terminate_handshake() - yield from self.connect(reconnect=True) + try: + yield from self.connect(reconnect=True) + except asyncio.TimeoutError: + # at this point we've retried 5 times... let's continue the loop. + log.warning('Could not connect to voice... Retrying...') + continue @asyncio.coroutine def disconnect(self, *, force=False):