mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 23:50:45 +00:00
Two more review findings on the connection-reuse path: - Verify the source connection's endpoint matches the duplicate's requested hostname/port/username before reusing it. A saved host edited after the source tab connected would otherwise let the copy silently open on the old connection and run commands on the wrong machine. findReusableSession now takes the requested target and requires an exact endpoint match; the session records its actual SSH endpoint at connect. - Wrap conn.shell() in the reuse path with try/catch. ssh2 can throw synchronously (e.g. "Not connected") if the borrowed transport dropped between findReusableSession and the shell request; without this the up-front connection ref hold would leak. On a synchronous throw we now drop the error listener, release the ref, and fall back to a fresh connection. Adds tests for endpoint mismatch and synchronous shell failure. Refs #1204 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>