mirror of
https://github.com/danbulant/discord.js
synced 2026-07-08 12:40:50 +00:00
voice: delete receive stream immediately to prevent it being written to after end (#2678)
This commit is contained in:
parent
c10b4feeeb
commit
46fa9603c2
2 changed files with 8 additions and 2 deletions
|
|
@ -184,7 +184,10 @@ class VoiceWebSocket extends EventEmitter {
|
||||||
case VoiceOPCodes.CLIENT_DISCONNECT:
|
case VoiceOPCodes.CLIENT_DISCONNECT:
|
||||||
for (const receiver of this.connection.receivers) {
|
for (const receiver of this.connection.receivers) {
|
||||||
const streamInfo = receiver.packets.streams.get(packet.d.user_id);
|
const streamInfo = receiver.packets.streams.get(packet.d.user_id);
|
||||||
if (streamInfo) streamInfo.stream.push(null);
|
if (streamInfo) {
|
||||||
|
receiver.packets.streams.delete(packet.d.user_id);
|
||||||
|
streamInfo.stream.push(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VoiceOPCodes.SPEAKING:
|
case VoiceOPCodes.SPEAKING:
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ class PacketHandler extends EventEmitter {
|
||||||
|
|
||||||
_stoppedSpeaking(userID) {
|
_stoppedSpeaking(userID) {
|
||||||
const streamInfo = this.streams.get(userID);
|
const streamInfo = this.streams.get(userID);
|
||||||
if (streamInfo && streamInfo.end === 'silence') streamInfo.stream.push(null);
|
if (streamInfo && streamInfo.end === 'silence') {
|
||||||
|
this.streams.delete(userID);
|
||||||
|
streamInfo.stream.push(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
makeStream(user, end) {
|
makeStream(user, end) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue