Bandwidth throttling: --bwlimit <KB/s> with token bucket

- protocol.h/c: io_set_bwlimit() + token bucket in send_n_data
  (64KB chunks, nanosleep-based deficit compensation)
- client_cli.c: --bwlimit <KB/s> flag
- test.py: bandwidth limit test case
This commit is contained in:
2026-07-16 15:42:16 +02:00
parent c2436bef59
commit 09a76e2a9a
4 changed files with 62 additions and 1 deletions
+1
View File
@@ -9,6 +9,7 @@ typedef int Status;
enum NET_STATUS { STATUS_OK, STATUS_ERROR, STATUS_FINISHED, STATUS_NEXT, STATUS_CHUNK, STATUS_MANIFEST };
void io_set_fds(int read_fd, int write_fd);
void io_set_bwlimit(unsigned long long bytes_per_sec);
bool send_n_data(int file_descriptor, void *data, size_t data_size);
bool receive_n_data(int file_descriptor, void *data, size_t data_size);