From 5afd31e21c47c346664e12e811314cca5d63a8c4 Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Fri, 18 Mar 2022 01:40:38 +0000 Subject: [PATCH] Set streaming flag in prepare_setup_transfers(). Avoids conditionally duplicating this across three other places. --- host/libhackrf/src/hackrf.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c index 555e74a2..89f86a9f 100644 --- a/host/libhackrf/src/hackrf.c +++ b/host/libhackrf/src/hackrf.c @@ -1831,6 +1831,8 @@ static int prepare_setup_transfers(hackrf_device* device, return result; } + device->streaming = true; + return HACKRF_SUCCESS; } @@ -1894,9 +1896,6 @@ int ADDCALL hackrf_start_rx(hackrf_device* device, hackrf_sample_block_cb_fn cal { result = prepare_setup_transfers(device, endpoint_address, callback); } - if (result == HACKRF_SUCCESS) { - device->streaming = true; - } return result; } @@ -1944,9 +1943,6 @@ int ADDCALL hackrf_start_tx(hackrf_device* device, hackrf_sample_block_cb_fn cal device->tx_ctx = tx_ctx; result = prepare_setup_transfers(device, endpoint_address, callback); } - if (result == HACKRF_SUCCESS) { - device->streaming = true; - } return result; } @@ -2678,9 +2674,6 @@ int ADDCALL hackrf_start_rx_sweep(hackrf_device* device, hackrf_sample_block_cb_ device->rx_ctx = rx_ctx; result = prepare_setup_transfers(device, endpoint_address, callback); } - if (result == HACKRF_SUCCESS) { - device->streaming = true; - } return result; }