Skip to content

Commit

Permalink
Fix dropping STH by id
Browse files Browse the repository at this point in the history
  • Loading branch information
patuwwy committed Mar 29, 2023
1 parent e8c1725 commit e72220b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/cli/src/lib/commands/space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ export const space: CommandDefinition = (program) => {
.argument("<space_name>", "The name of the Space")
.option("--id <id>", "Hub Id")
.option("--all", "Disconnects all self-hosted Hubs connected to Space", false)
.action(async (spaceName: string, id: string, all: string) => {
.action(async (spaceName: string, options: { id: string, all: boolean }) => {
const mwClient = getMiddlewareClient();
const managerClient = mwClient.getManagerClient(spaceName);
let opts = { } as PostDisconnectPayload;

if (typeof id === "string") {
opts = { id };
if (typeof options.id === "string") {
opts = { id: options.id };
}

if (all) {
if (options.all) {
opts = { limit: 0 };
}

Expand Down
6 changes: 2 additions & 4 deletions packages/host/src/lib/cpm-connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,6 @@ export class CPMConnector extends TypedEmitter<Events> {
[CPMMessageCode.NETWORK_INFO, await this.getNetworkInfo()]
);




this.emit("connect");

return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -344,7 +341,8 @@ export class CPMConnector extends TypedEmitter<Events> {

connection.socket
.once("close", async () => {
this.logger.warn("CLOSE STATUS", connection.res.statusCode)
this.logger.warn("CLOSE STATUS", connection.res.statusCode);

await this.handleConnectionClose(connection.res.statusCode || -1);
});
} catch (error: any) {
Expand Down

0 comments on commit e72220b

Please sign in to comment.