VoiceConnection rework (#1183)

* VoiceConnection rework

- improves codebase
- removes concept of pending connections
- attempts to fix memory leaks by removing EventEmitter listeners
- makes voice connections keep track of its own channel when it is moved by another user
- allows voice connections to reconnect when Discord falls back to another voice server or a region change occurs
- adds events for some of the aforementioned events

* Removed unused code

* More clean up / bugfixes

* Added typedefs to Status and VoiceStatus constants
This commit is contained in:
Programmix
2017-02-22 12:13:52 -08:00
committed by Amish Shah
parent eb069d0249
commit 7fd94c29d8
7 changed files with 350 additions and 276 deletions

View File

@@ -47,12 +47,12 @@ class VoiceConnectionUDPClient extends EventEmitter {
shutdown() {
if (this.socket) {
this.socket.removeAllListeners('message');
try {
this.socket.close();
} catch (e) {
return;
} finally {
this.socket = null;
}
this.socket = null;
}
}