Fix timeouts and errors not emitting "close"

This commit is contained in:
2025-01-08 21:11:45 -06:00
parent 617c8df511
commit 2ffed2204b
8 changed files with 14 additions and 8 deletions

View File

@ -76,11 +76,11 @@ export class Unit extends EventEmitter {
return;
}
debugUnit("closing connection by request");
this.emit("close");
this.client.close();
}
socketCleanup = () => {
debugUnit("socket cleanup");
this.emit("close");
this.client?.removeAllListeners();
this.client = undefined;
if (this.pingTimeout) {