diff options
| author | Rapptz <[email protected]> | 2016-06-14 22:33:25 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-06-14 22:33:25 -0400 |
| commit | e736554777344757dc968f7cda019b319fc5c3bf (patch) | |
| tree | d6bc082a278a70410e1c5dca01dc1e4df3523730 | |
| parent | Make Channel.overwrites_for return PermissionOverwrite (diff) | |
| download | discord.py-e736554777344757dc968f7cda019b319fc5c3bf.tar.xz discord.py-e736554777344757dc968f7cda019b319fc5c3bf.zip | |
Make sure the socket is closed when we call VoiceClient.disconnect
| -rw-r--r-- | discord/voice_client.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/discord/voice_client.py b/discord/voice_client.py index 6f62d4ef..9414bda0 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -253,10 +253,12 @@ class VoiceClient: if not self._connected.is_set(): return - self.socket.close() self._connected.clear() - yield from self.ws.close() - yield from self.main_ws.voice_state(self.guild_id, None, self_mute=True) + try: + yield from self.ws.close() + yield from self.main_ws.voice_state(self.guild_id, None, self_mute=True) + finally: + self.socket.close() @asyncio.coroutine def move_to(self, channel): |