diff options
| author | Rapptz <[email protected]> | 2016-03-31 23:44:22 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-03-31 23:44:22 -0400 |
| commit | ee4574a5e118e632c04b3d68e6e95ef85793bde6 (patch) | |
| tree | 6d32ba92ba4fe83e44b41db5a289c4f6ecc08ab8 | |
| parent | Add PyNaCl to the list of requirements. (diff) | |
| download | discord.py-ee4574a5e118e632c04b3d68e6e95ef85793bde6.tar.xz discord.py-ee4574a5e118e632c04b3d68e6e95ef85793bde6.zip | |
Drop voice packets when it can be potentially blocking.
| -rw-r--r-- | discord/voice_client.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/discord/voice_client.py b/discord/voice_client.py index 34e8a7a3..c3286ec2 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -672,5 +672,9 @@ class VoiceClient: else: encoded_data = data packet = self._get_voice_packet(encoded_data) - sent = self.socket.sendto(packet, (self.endpoint_ip, self.voice_port)) + try: + sent = self.socket.sendto(packet, (self.endpoint_ip, self.voice_port)) + except BlockingIOError: + log.warning('A packet has been dropped (seq: {0.sequence}, timestamp: {0.timestamp})'.format(self)) + self.checked_add('timestamp', self.encoder.samples_per_frame, 4294967295) |