From a31438a0004434c921679b025df271300d3b45dc Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 9 Jan 2022 20:37:49 +0100 Subject: Fix buffer init in fl2k_tcp interleaved mode --- src/fl2k_tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/fl2k_tcp.c b/src/fl2k_tcp.c index c93777b..44d73e7 100644 --- a/src/fl2k_tcp.c +++ b/src/fl2k_tcp.c @@ -104,7 +104,8 @@ static void sighandler(int signum) void fl2k_callback(fl2k_data_info_t *data_info) { - int left = FL2K_BUF_LEN; + const int required_samples = FL2K_BUF_LEN * (interleaved ? 2 : 1); + int left = required_samples; int received; int r; struct timeval tv = { 1, 0 }; @@ -133,7 +134,7 @@ void fl2k_callback(fl2k_data_info_t *data_info) r = select(sock + 1, &readfds, NULL, NULL, &tv); if (r) { - received = recv(sock, txbuf + (FL2K_BUF_LEN - left), left, 0); + received = recv(sock, txbuf + (required_samples - left), left, 0); if (!received) { fprintf(stderr, "Connection was closed!\n"); fl2k_stop_tx(dev); -- cgit v1.2.3