Files
opentui/packages/ssh/src/ssh2-augment.d.ts
T
Simon Klee 28b27a587e ssh: disable Nagle's algorithm on accepted connections (#1531)
On Node, a server socket keeps Nagle's algorithm enabled. A frame
written as more than one small packet then waits for the client's
delayed ACK. On Linux that adds about 40 ms to each reply. Bun's sockets
are not affected.

Call setNoDelay(true) on each accepted ssh2 connection, after the close
and error handlers are registered, so a failure is reported through the
normal cleanup path.

Loopback ssh2 probe, two small writes per reply, client with TCP_NODELAY
(as interactive OpenSSH sets it), median of 60 replies:

  node 26.4  off 41.011 ms  on 0.107 ms
  node 26.7  off 41.003 ms  on 0.106 ms
  bun 1.4    off  0.048 ms  on 0.045 ms
2026-09-25 09:39:00 +02:00

17 lines
587 B
TypeScript

// @types/ssh2 (1.15.x) lags the ssh2 1.17 runtime. Re-declare the runtime fields
// it omits so call sites stay cast-free. Drop entries here as DefinitelyTyped
// catches up. This augments ssh2's own types only — nothing here is re-exported.
export {}
declare module "ssh2" {
interface PseudoTtyInfo {
/** The client's requested `TERM`. Sent at runtime; omitted by @types/ssh2. */
term?: string
}
interface Connection {
/** Calls `setNoDelay()` on the underlying socket. Documented by ssh2; omitted by @types/ssh2. */
setNoDelay(noDelay?: boolean): this
}
}