Browse Source

Close voice connections before closing the websocket.

pull/224/merge
Rapptz 9 years ago
parent
commit
8f4816ddae
  1. 12
      discord/client.py

12
discord/client.py

@ -418,13 +418,19 @@ class Client:
if self.is_closed: if self.is_closed:
return return
if self.ws is not None and self.ws.open:
yield from self.ws.close()
for voice in list(self.voice_clients): for voice in list(self.voice_clients):
try:
yield from voice.disconnect() yield from voice.disconnect()
except:
# if an error happens during disconnects, disregard it.
pass
self.connection._remove_voice_client(voice.server.id) self.connection._remove_voice_client(voice.server.id)
if self.ws is not None and self.ws.open:
yield from self.ws.close()
yield from self.session.close() yield from self.session.close()
self._closed.set() self._closed.set()
self._is_ready.clear() self._is_ready.clear()

Loading…
Cancel
Save