mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-24 09:16:29 +00:00
* fix SFTP transfer throughput regression * fix: address Codex review on PR #2429 * fix resumable transfer review findings * fix remaining resumable transfer review findings * fix: address Codex review on PR #2429 * fix(sftp): harden resumable range fallback and channel cleanup Truncate staged sparse tails to the contiguous checkpoint before stream fallback or pause, always release isolated download channels on cancel and failed fast paths, and stabilize concurrency unit tests. * fix(sftp): abort range transfers on isolated channel errors Attach a temporary SFTP error listener during concurrent range copies so channel resets reject cleanly instead of crashing main, and force-publish the contiguous checkpoint when pausing. * fix(sftp): never truncate S2S temp source on upload fallback stagedLocalPath during SFTP→SFTP upload is the fully-downloaded temp source, not a partial target. Only truncate partial download/local targets and remote .part staging files. * fix(sftp): truncate direct-download sparse tails on range fallback Direct SFTP→local resumable transfers keep resumeStage "direct" and never copied targetType onto the transfer object, so prepareStreamFallback skipped truncating the staged .part after out-of-order range failure. A later stream pause could then stat the oversized sparse file and advance past holes. Treat any staged local path outside the S2S upload phase as a partial target, persist target metadata on the transfer, and fix the sparse-tail test to assert against the real staged path. * fix(sftp): always end isolated upload channel on open failures uploadFileResumableFast assumed callers only saw throws after the isolated channel was already ended, but a failed local fs.open left the channel open while the catch path cleared fastSftp without disposing it. End the channel in a single finally covering local open, remote open, and range transfer. * test(sftp): stabilize local-open channel cleanup regression Make the missing-source upload case delete the file only after the isolated channel opens, and keep stream-fallback errors handled so the suite asserts channel disposal without unhandled stream ENOENTs. * fix resumable transfer fallback safety * fix(sftp): allow cancel while resumable OPEN is in flight Install transfer.abort before awaiting local/remote handles so cancel ends the isolated channel if the server stalls SFTP OPEN. Covers upload and download fast paths, with a regression test for stalled upload OPEN. * fix(sftp): detect same-size source rewrites via content samples Metadata-only checks can miss in-place rewrites when mtime/ctime do not advance. Sample SHA-256 digests through the open local handle before range upload and re-check after, and do the same path-level check for stream fallback. Harden the regression test by freezing utimes after rewrite. --------- Co-authored-by: netcatty-cursor-bot <41898282+github-actions[bot]@users.noreply.github.com>