mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 00:20:45 +00:00
Two reference-counting races found in review: - Reuse path read the source's connRef only inside the async conn.shell() callback. If the source tab closed while the shell was opening, releaseConnectionRef could drop the count to zero and end the shared connection out from under the opening channel. Now pin the connection (acquireConnectionRef) before issuing the async shell request and hand the hold over to the real session once the channel opens; release it on any failure so fallback to a fresh connection doesn't leak the count. - closeSession read session.connRef *after* stream.close(), but closing the channel can synchronously fire the stream "close" handler that nulls connRef and releases the connection — so the post-close check fell into the legacy path and ended the shared connection a second time. Snapshot the multiplexing flag before closing the channel. Adds a regression test covering "source closed while the copied shell is still opening". Refs #1204 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>