From 3fa3b0238e6054a139d694617dd2fc5e4d8ebdfd Mon Sep 17 00:00:00 2001 From: abalabahaha Date: Fri, 20 May 2016 20:42:33 -0700 Subject: [PATCH] Catch udp close errors --- lib/Voice/VoiceConnection.js | 8 ++++++-- src/Voice/VoiceConnection.js | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/Voice/VoiceConnection.js b/lib/Voice/VoiceConnection.js index 4607abb4b..83c14f370 100644 --- a/lib/Voice/VoiceConnection.js +++ b/lib/Voice/VoiceConnection.js @@ -94,8 +94,6 @@ var VoiceConnection = (function (_EventEmitter) { if (this.KAI) { clearInterval(this.KAI); } - this.vWS.close(); - this.udp.close(); this.client.internal.sendWS({ op: 4, d: { @@ -106,6 +104,12 @@ var VoiceConnection = (function (_EventEmitter) { } }); this.client.internal.voiceConnections.remove(this); + try { + this.vWS.close(); + } catch (e) {} + try { + this.udp.close(); + } catch (e) {} }; VoiceConnection.prototype.stopPlaying = function stopPlaying() { diff --git a/src/Voice/VoiceConnection.js b/src/Voice/VoiceConnection.js index 76d93207b..f0e685332 100644 --- a/src/Voice/VoiceConnection.js +++ b/src/Voice/VoiceConnection.js @@ -56,8 +56,6 @@ export default class VoiceConnection extends EventEmitter { if (this.KAI) { clearInterval(this.KAI); } - this.vWS.close(); - this.udp.close(); this.client.internal.sendWS( { op : 4, @@ -70,6 +68,12 @@ export default class VoiceConnection extends EventEmitter { } ); this.client.internal.voiceConnections.remove(this); + try { + this.vWS.close(); + } catch(e) {} + try { + this.udp.close(); + } catch(e) {} } stopPlaying() {