refactor: merge sendfile and single_calls _no_path variants with send_path bool #19
Reference in New Issue
Block a user
Delete Branch "refactor/merge-path-variants"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Replace four send functions (file_send_sendfile, file_send_sendfile_no_path, file_send_single_calls, file_send_single_calls_no_path) with two functions that accept a send_path boolean parameter.
Removes ~50 lines of duplicated code. The only behavioral difference between each pair was whether send_str() was called to transmit the file path, so a single send_path bool covers both cases cleanly.
PR Review
Verdict: PASS — Clean refactor, reduces code duplication
Files reviewed: 16 (includes incremental-sync changes + path variant merge)
Core Refactor
Merges
_no_pathvariants into the main functions by adding abool send_pathparameter:file_send_single_calls(file, fd, use_metadata, compression_level, send_path)— ifsend_path=false, skips sending the path (receiver already has it fromSTATUS_CHECK)file_send_sendfile(file, fd, use_metadata, send_path)— same pattern_no_pathvariants removedclient_send.cpasstrue(normal) orfalse(incremental) based on contextWhat looks good
send_pathbool is clear and self-documentingdata_to_sendpointer +compressed_datafor cleanup, no mutation offile->datacompressed_dataincremental_check()helper extractedSTATUS_ERRORsends on all error paths inmultiprocessing.cmetadata_receive()okparameter for I/O error detection--incremental+-srejection, auto-MMinor observations (non-blocking)
STATUS_CHECKadded to protocol enum andstatus_to_string()— correct.server.cSTATUS_CHECK handler duplicatesmultiprocessing.chandler logic (both do the same stat comparison + receive). This is inherent to the fork-based vs threaded architecture.Safe to merge.