fix(onebot): bring an account back when shutdown stalls

If the previous OneBot session does not finish closing, the account now
comes back online instead of staying disconnected until QQ is restarted.

Fixes #509
This commit is contained in:
DrSmoothl committed 2026-10-06 00:11:44 +08:00
1 parent e0801ff9eb
commit 940b823571
11 files changed
+273 -8

No files matched your search

@@ -212,6 +212,17 @@ export class WsServerConnections {
this.connections.clear();
}
/** Destroy sockets immediately. A graceful close frame can leave the
* listener waiting on a peer that will never answer. */
terminateAll(): void {
this.stopAccepting();
for (const connection of this.connections.values()) {
connection.stopHeartbeat();
try { connection.socket.terminate(); } catch { /* already gone */ }
}
this.connections.clear();
}
private async handleApiMessage(socket: WebSocket, role: WsRole, raw: Buffer | string): Promise<void> {
const text = rawDataToString(raw);
if (!text) {