Files
Netcatty/electron/bridges/emitTerminalSessionData.cjs
T
bincxz b3bf566db4 fix(terminal): keep input responsive during high-output floods (#1711)
Tighten renderer output back-pressure (128KB/32KB watermarks), account
coalescer and write-queue backlog, drain output on user keystrokes, and
add main-process IPC ACK flow control so SSH floods cannot starve Ctrl+C
and other keyboard input.

Closes #1711
2026-06-27 01:53:41 +08:00

24 lines
642 B
JavaScript

"use strict";
const { trackEmitted } = require("./terminalFlowAck.cjs");
let getSession = null;
function configureTerminalSessionDataEmitter(options = {}) {
getSession = typeof options.getSession === "function" ? options.getSession : null;
}
function emitTerminalSessionData(contents, sessionId, data) {
if (getSession && sessionId && data) {
const session = getSession(sessionId);
if (session) {
trackEmitted(session, typeof data === "string" ? data.length : 0);
}
}
contents?.send("netcatty:data", { sessionId, data });
}
module.exports = {
configureTerminalSessionDataEmitter,
emitTerminalSessionData,
};