mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 07:32:54 +00:00
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
24 lines
642 B
JavaScript
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,
|
|
}; |