From 98be48bb1338034aadb93b1a311c4daeceec7465 Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Mon, 12 May 2025 06:31:37 +0900 Subject: [PATCH] fix(music-together): fix connection disconnect message --- src/plugins/music-together/connection.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/music-together/connection.ts b/src/plugins/music-together/connection.ts index 936b6f1e..f0a72420 100644 --- a/src/plugins/music-together/connection.ts +++ b/src/plugins/music-together/connection.ts @@ -135,6 +135,11 @@ export class Connection { if (this._mode === 'disconnected') throw new Error('Already disconnected'); this._mode = 'disconnected'; + this.getConnections().forEach((conn) => + conn.close({ + flush: true, + }), + ); this.connections = {}; this.connectionListeners = []; for (const listener of this.listeners) { @@ -228,6 +233,9 @@ export class Connection { this.connectionListeners.forEach((listener) => listener(conn)); if (err) { + if (err.type === 'connection-closed') { + this.connectionListeners.forEach((listener) => listener()); + } reject(err); } };