1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-27 04:35:25 +00:00

Only replay terminals when detached

This commit is contained in:
Asher 2020-11-19 10:58:04 -06:00
parent 8311cf5657
commit 182aca6490
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -1466,10 +1466,10 @@ index 0000000000000000000000000000000000000000..6ce56bec114a6d8daf5dd3ded945ea78
+} +}
diff --git a/src/vs/server/node/channel.ts b/src/vs/server/node/channel.ts diff --git a/src/vs/server/node/channel.ts b/src/vs/server/node/channel.ts
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..cb3a45fda10a6bcbff73275b5734641b3319cc9b index 0000000000000000000000000000000000000000..b65bf283739a2b05c82fe38a038d2a10957c0d40
--- /dev/null --- /dev/null
+++ b/src/vs/server/node/channel.ts +++ b/src/vs/server/node/channel.ts
@@ -0,0 +1,828 @@ @@ -0,0 +1,848 @@
+import { field, logger } from '@coder/logger'; +import { field, logger } from '@coder/logger';
+import { Server } from '@coder/node-browser'; +import { Server } from '@coder/node-browser';
+import * as os from 'os'; +import * as os from 'os';
@ -1893,6 +1893,7 @@ index 0000000000000000000000000000000000000000..cb3a45fda10a6bcbff73275b5734641b
+ private readonly maxReplayData = 10000; + private readonly maxReplayData = 10000;
+ private totalReplayData = 0; + private totalReplayData = 0;
+ +
+ private detached = false;
+ private buffering = false; + private buffering = false;
+ private readonly _onEvent = new Emitter<terminal.IRemoteTerminalProcessEvent>({ + private readonly _onEvent = new Emitter<terminal.IRemoteTerminalProcessEvent>({
+ // Don't bind to data until something is listening. + // Don't bind to data until something is listening.
@ -1906,10 +1907,11 @@ index 0000000000000000000000000000000000000000..cb3a45fda10a6bcbff73275b5734641b
+ +
+ // Replay stored events. + // Replay stored events.
+ onFirstListenerDidAdd: () => { + onFirstListenerDidAdd: () => {
+ if (this.replayData.length === 0) { + if (!this.detached) {
+ return; + return;
+ } + }
+ +
+ this.detached = false;
+ logger.debug('Terminal replaying', field('id', this.id)); + logger.debug('Terminal replaying', field('id', this.id));
+ this._onEvent.fire({ + this._onEvent.fire({
+ type: 'replay', + type: 'replay',
@ -1922,6 +1924,7 @@ index 0000000000000000000000000000000000000000..cb3a45fda10a6bcbff73275b5734641b
+ }, + },
+ +
+ onLastListenerRemove: () => { + onLastListenerRemove: () => {
+ this.detached = true;
+ logger.debug('Terminal unbound', field('id', this.id)); + logger.debug('Terminal unbound', field('id', this.id));
+ if (!this.persist) { // Used by debug consoles. + if (!this.persist) { // Used by debug consoles.
+ this.dispose(); + this.dispose();