quality: send_chunk has deeply nested if-else with duplicated file-sending loops #46
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
In src/client/client_send.c:128-181, the send_chunk function has three separate code paths with near-identical loops for sending individual files:
Paths B and C have identical structure:
The only difference is the send function pointer. This duplicated code should be unified. Additionally, the function has too many responsibilities (serialization dispatch + per-file sending + incremental logic).
Suggested Fix: Extract a shared helper function for per-file sending that accepts the send function as a parameter, eliminating the duplicated loop structure.
Severity: low