Skip to content

Commit 6ca11d8

Browse files
author
Akos Kitta
committed
fix: no ws connection dispose on monitor error
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent c2f15e2 commit 6ca11d8

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

arduino-ide-extension/src/node/monitor-manager-proxy-impl.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { inject, injectable } from '@theia/core/shared/inversify';
2-
import { Disposable } from '@theia/core/lib/common/disposable';
32
import {
43
MonitorManagerProxy,
54
MonitorManagerProxyClient,
@@ -12,7 +11,7 @@ import {
1211
} from './monitor-settings/monitor-settings-provider';
1312

1413
export interface ConnectToClient {
15-
(): Promise<Disposable>;
14+
(): Promise<void>;
1615
}
1716

1817
@injectable()
@@ -55,7 +54,6 @@ export class MonitorManagerProxyImpl implements MonitorManagerProxy {
5554
);
5655
}
5756
await this.client.connect(address);
58-
return Disposable.create(() => this.client?.disconnect());
5957
};
6058
return this.manager.startMonitor(board, port, connectToClient);
6159
}

arduino-ide-extension/src/node/monitor-manager.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class MonitorManager extends CoreClientAware {
4242
private monitorServiceStartQueue: {
4343
monitorID: string;
4444
serviceStartParams: [Board, Port];
45-
connectToClient: () => void;
45+
connectToClient: ConnectToClient;
4646
}[] = [];
4747

4848
@inject(MonitorServiceFactory)
@@ -133,12 +133,11 @@ export class MonitorManager extends CoreClientAware {
133133
return;
134134
}
135135

136-
const disposable = await connectToClient();
137136
try {
137+
await connectToClient();
138138
await monitor.start();
139139
} catch (err) {
140140
if (!AlreadyConnectedError.is(err)) {
141-
disposable.dispose();
142141
throw err;
143142
}
144143
}
@@ -272,8 +271,8 @@ export class MonitorManager extends CoreClientAware {
272271
const monitorService = this.monitorServices.get(monitorID);
273272

274273
if (monitorService) {
274+
await connectToClient();
275275
await monitorService.start();
276-
connectToClient();
277276
}
278277
}
279278
}

0 commit comments

Comments
 (0)