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:
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) {
|
||||
|
||||
Reference in new issue
Block a user