feat: add SSH transport, rsync-style CLI, and --stdio server mode

- Replace send()/recv() with read()/write() + io_set_fds() for fd abstraction
- Add client_connect_ssh() via socketpair + fork/exec; reap child in client_disconnect()
- Add server --stdio flag for SSH invocation
- Replace handle_arg() with rsync-style positional args (fastsync <src> <dest>)
- Add SSH vs TCP auto-detection via is_remote_dest()
- Add TransportType and ssh_destination to Config, fix uninitialized fields in
  config_receive() (pre-existing multithreaded crash)
- Sender threads now wait for server STATUS_OK before disconnecting
- Add --help, error handling for sendfile+SSH combos
- Add pre-flight checks and Posix Args test case to test.py
- Add test_config_ssh_dest() unit test
This commit is contained in:
2026-07-06 18:42:33 +02:00
parent e4ab2a414c
commit fbd7ccf4dd
8 changed files with 347 additions and 40 deletions
+5
View File
@@ -22,6 +22,8 @@ Config *config_create(char *version, char *send_directory,
config->compression_level = compression_level;
config->num_connections = num_connections;
config->use_sendfile = use_sendfile;
config->transport = TRANSPORT_TCP;
config->ssh_destination = NULL;
return config;
}
@@ -29,6 +31,7 @@ void config_delete(Config *config) {
free(config->version);
free(config->send_directory);
free(config->receive_root_directory);
free(config->ssh_destination);
free(config);
}
@@ -63,6 +66,8 @@ Config *config_receive(int file_descriptor) {
config->compression_level = receive_int(file_descriptor);
config->num_connections = receive_int(file_descriptor);
config->use_sendfile = receive_int(file_descriptor);
config->transport = TRANSPORT_TCP;
config->ssh_destination = NULL;
send_status(file_descriptor, STATUS_OK);
return config;
}