More forwarded ports trace logging

This commit is contained in:
Alex Ross
2021-03-03 15:39:24 +01:00
parent 65c0eeb03d
commit f80f0d7074
5 changed files with 36 additions and 22 deletions

View File

@@ -18,6 +18,7 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { isNumber, isObject, isString } from 'vs/base/common/types';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { hash } from 'vs/base/common/hash';
import { ILogService } from 'vs/platform/log/common/log';
export const IRemoteExplorerService = createDecorator<IRemoteExplorerService>('remoteExplorerService');
export const REMOTE_EXPLORER_TYPE_KEY: string = 'remote.explorerType';
@@ -269,7 +270,8 @@ export class TunnelModel extends Disposable {
@IConfigurationService private readonly configurationService: IConfigurationService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
@IRemoteAuthorityResolverService private readonly remoteAuthorityResolverService: IRemoteAuthorityResolverService,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@ILogService private readonly logService: ILogService
) {
super();
this.portsAttributes = new PortsAttributes(configurationService);
@@ -355,6 +357,7 @@ export class TunnelModel extends Disposable {
const tunnelRestoreValue = await this.tunnelRestoreValue;
if (tunnelRestoreValue) {
const tunnels = <Tunnel[] | undefined>JSON.parse(tunnelRestoreValue) ?? [];
this.logService.trace(`ForwardedPorts: (TunnelModel) restoring ports ${tunnels.map(tunnel => tunnel.remotePort).join(', ')}`);
for (let tunnel of tunnels) {
if (!mapHasAddressLocalhostOrAllInterfaces(this.detected, tunnel.remoteHost, tunnel.remotePort)) {
await this.forward({ host: tunnel.remoteHost, port: tunnel.remotePort }, tunnel.localPort, tunnel.name, undefined, undefined, tunnel.privacy === TunnelPrivacy.Public);
@@ -482,6 +485,7 @@ export class TunnelModel extends Disposable {
processedCandidates = await this._candidateFilter(candidates);
}
const removedCandidates = this.updateInResponseToCandidates(processedCandidates);
this.logService.trace(`ForwardedPorts: (TunnelModel) removed candidates ${Array.from(removedCandidates.values()).map(candidate => candidate.port).join(', ')}`);
this._onCandidatesChanged.fire(removedCandidates);
}
@@ -592,9 +596,10 @@ class RemoteExplorerService implements IRemoteExplorerService {
@IConfigurationService configurationService: IConfigurationService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService,
@IWorkspaceContextService workspaceContextService: IWorkspaceContextService
@IWorkspaceContextService workspaceContextService: IWorkspaceContextService,
@ILogService logService: ILogService
) {
this._tunnelModel = new TunnelModel(tunnelService, storageService, configurationService, environmentService, remoteAuthorityResolverService, workspaceContextService);
this._tunnelModel = new TunnelModel(tunnelService, storageService, configurationService, environmentService, remoteAuthorityResolverService, workspaceContextService, logService);
}
set targetType(name: string[]) {