提交 b740c97e 编写于 作者: A Alex Dima

More eventing

上级 5582306f
......@@ -18,6 +18,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { RemoteExtensionEnvironmentChannelClient } from 'vs/workbench/services/remote/common/remoteAgentEnvironmentChannel';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IDiagnosticInfoOptions, IDiagnosticInfo } from 'vs/platform/diagnostics/common/diagnosticsService';
import { Emitter } from 'vs/base/common/event';
export abstract class AbstractRemoteAgentService extends Disposable implements IRemoteAgentService {
......@@ -59,6 +60,9 @@ export abstract class AbstractRemoteAgentService extends Disposable implements I
export class RemoteAgentConnection extends Disposable implements IRemoteAgentConnection {
private readonly _onReconnecting = this._register(new Emitter<void>());
public readonly onReconnecting = this._onReconnecting.event;
readonly remoteAuthority: string;
private _connection: Promise<Client<RemoteAgentConnectionContext>> | null;
......@@ -90,12 +94,18 @@ export class RemoteAgentConnection extends Disposable implements IRemoteAgentCon
}
private async _createConnection(): Promise<Client<RemoteAgentConnectionContext>> {
let firstCall = true;
const options: IConnectionOptions = {
isBuilt: this._environmentService.isBuilt,
commit: this._commit,
webSocketFactory: this._webSocketFactory,
addressProvider: {
getAddress: async () => {
if (firstCall) {
firstCall = false;
} else {
this._onReconnecting.fire(undefined);
}
const { host, port } = await this._remoteAuthorityResolverService.resolveAuthority(this.remoteAuthority);
return { host, port };
}
......
......@@ -7,6 +7,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
import { RemoteAgentConnectionContext, IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment';
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
import { IDiagnosticInfoOptions, IDiagnosticInfo } from 'vs/platform/diagnostics/common/diagnosticsService';
import { Event } from 'vs/base/common/event';
export const RemoteExtensionLogFileName = 'remoteagent';
......@@ -25,4 +26,5 @@ export interface IRemoteAgentConnection {
getChannel<T extends IChannel>(channelName: string): T;
registerChannel<T extends IServerChannel<RemoteAgentConnectionContext>>(channelName: string, channel: T): void;
onReconnecting: Event<void>;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册