Merge pull request #117766 from microsoft/tyriar/remove_flow_control

Remove flow control setting
This commit is contained in:
Daniel Imms 2021-03-04 08:43:57 -08:00 committed by GitHub
commit cb7ad05cb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 14 additions and 39 deletions

View file

@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.55.0",
"distro": "554eb3a374b57363e730dd1aacc561a4c9da5780",
"distro": "d8be554a1c1d72fb929c31336025a2ca9d73591b",
"author": {
"name": "Microsoft Corporation"
},

View file

@ -226,11 +226,6 @@ export interface IShellLaunchConfig {
*/
isFeatureTerminal?: boolean;
/**
* Whether flow control is enabled for this terminal.
*/
flowControl?: boolean;
/**
* Whether this terminal was created by an extension.
*/

View file

@ -38,7 +38,6 @@ export interface ICompleteTerminalConfiguration {
'terminal.integrated.inheritEnv': boolean;
'terminal.integrated.cwd': string;
'terminal.integrated.detectLocale': 'auto' | 'off' | 'on';
'terminal.flowControl': boolean;
}
export type ITerminalEnvironmentVariableCollections = [string, ISerializableEnvironmentVariableCollection][];

View file

@ -188,14 +188,15 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
this.onProcessReady(() => c());
});
ptyProcess.onData(data => {
if (this._shellLaunchConfig.flowControl) {
this._unacknowledgedCharCount += data.length;
if (!this._isPtyPaused && this._unacknowledgedCharCount > FlowControlConstants.HighWatermarkChars) {
this._logService.trace(`Flow control: Pause (${this._unacknowledgedCharCount} > ${FlowControlConstants.HighWatermarkChars})`);
this._isPtyPaused = true;
ptyProcess.pause();
}
// Handle flow control
this._unacknowledgedCharCount += data.length;
if (!this._isPtyPaused && this._unacknowledgedCharCount > FlowControlConstants.HighWatermarkChars) {
this._logService.trace(`Flow control: Pause (${this._unacknowledgedCharCount} > ${FlowControlConstants.HighWatermarkChars})`);
this._isPtyPaused = true;
ptyProcess.pause();
}
// Refire the data event
this._onProcessData.fire(data);
if (this._closeTimeout) {
clearTimeout(this._closeTimeout);
@ -369,9 +370,6 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
}
public acknowledgeDataEvent(charCount: number): void {
if (!this._shellLaunchConfig.flowControl) {
return;
}
// Prevent lower than 0 to heal from errors
this._unacknowledgedCharCount = Math.max(this._unacknowledgedCharCount - charCount, 0);
this._logService.trace(`Flow control: Ack ${charCount} chars (unacknowledged: ${this._unacknowledgedCharCount})`);
@ -383,10 +381,6 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
}
public clearUnacknowledgedChars(): void {
if (!this._shellLaunchConfig.flowControl) {
return;
}
this._unacknowledgedCharCount = 0;
this._logService.trace(`Flow control: Cleared all unacknowledged chars, forcing resume`);
if (this._isPtyPaused) {

View file

@ -247,6 +247,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
this._proxy.$acceptTerminalMaximumDimensions(instance.instanceId, instance.maxCols, instance.maxRows);
}
private _onRequestStartExtensionTerminal(request: IStartExtensionTerminalRequest): void {
const proxy = request.proxy;
this._terminalProcessProxies.set(proxy.instanceId, proxy);

View file

@ -1549,7 +1549,6 @@ export interface IShellLaunchConfigDto {
cwd?: string | UriComponents;
env?: { [key: string]: string | null; };
hideFromUser?: boolean;
flowControl?: boolean;
}
export interface IShellDefinitionDto {

View file

@ -1030,9 +1030,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
const messageId = ++this._latestXtermWriteData;
this._xterm?.write(ev.data, () => {
this._latestXtermParseData = messageId;
if (this._shellLaunchConfig.flowControl) {
this._processManager.acknowledgeDataEvent(ev.data.length);
}
this._processManager.acknowledgeDataEvent(ev.data.length);
});
}
}

View file

@ -119,8 +119,8 @@ export class TerminalProcessExtHostProxy extends Disposable implements ITerminal
this._onResize.fire({ cols, rows });
}
public acknowledgeDataEvent(charCount: number): void {
this._onAcknowledgeDataEvent.fire(charCount);
public acknowledgeDataEvent(): void {
// Flow control is disabled for extension terminals
}
public getInitialCwd(): Promise<string> {

View file

@ -153,10 +153,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
rows: number,
isScreenReaderModeEnabled: boolean
): Promise<ITerminalLaunchError | undefined> {
shellLaunchConfig.flowControl = this._configHelper.config.flowControl;
if (shellLaunchConfig.isExtensionCustomPtyTerminal) {
// Flow control is not supported for extension terminals
shellLaunchConfig.flowControl = false;
this._processType = ProcessType.ExtensionTerminal;
this._process = this._instantiationService.createInstance(TerminalProcessExtHostProxy, this._instanceId, shellLaunchConfig, cols, rows);
} else {

View file

@ -55,7 +55,6 @@ export interface ICompleteTerminalConfiguration {
'terminal.integrated.inheritEnv': boolean;
'terminal.integrated.cwd': string;
'terminal.integrated.detectLocale': 'auto' | 'off' | 'on';
'terminal.flowControl': boolean;
}
export type ITerminalEnvironmentVariableCollections = [string, ISerializableEnvironmentVariableCollection][];
@ -241,8 +240,7 @@ export class RemoteTerminalChannelClient {
'terminal.integrated.env.linux': this._readSingleTerminalConfiguration('terminal.integrated.env.linux'),
'terminal.integrated.inheritEnv': terminalConfig.inheritEnv,
'terminal.integrated.cwd': terminalConfig.cwd,
'terminal.integrated.detectLocale': terminalConfig.detectLocale,
'terminal.flowControl': terminalConfig.flowControl
'terminal.integrated.detectLocale': terminalConfig.detectLocale
};
// We will use the resolver service to resolve all the variables in the config / launch config

View file

@ -140,7 +140,6 @@ export interface ITerminalConfiguration {
localEchoExcludePrograms: ReadonlyArray<string>;
localEchoStyle: 'bold' | 'dim' | 'italic' | 'underlined' | 'inverted' | string;
enablePersistentSessions: boolean;
flowControl: boolean;
}
export const DEFAULT_LOCAL_ECHO_EXCLUDE: ReadonlyArray<string> = ['vim', 'vi', 'nano', 'tmux'];

View file

@ -397,11 +397,6 @@ export const terminalConfiguration: IConfigurationNode = {
description: localize('terminal.integrated.enablePersistentSessions', "Persist terminal sessions for the workspace across window reloads."),
type: 'boolean',
default: true
},
'terminal.integrated.flowControl': {
description: localize('terminal.integrated.flowControl', "Experimental: whether to enable flow control which will slow the program on the remote side to avoid flooding remote connections with terminal output. This setting has no effect for local terminals and terminals where the output/input is controlled by an extension. Changing this will only affect new terminals."),
type: 'boolean',
default: true
}
}
};