Clear streaming flag in cancel_transfers().

Moving this into cancel_transfers() avoids duplicating it in the two
stop functions.
This commit is contained in:
Martin Ling
2022-03-18 01:28:26 +00:00
parent c74c742391
commit 960d8015a4

View File

@ -218,6 +218,9 @@ static int cancel_transfers(hackrf_device* device)
uint32_t transfer_index; uint32_t transfer_index;
int i; int i;
// If we're cancelling transfers for any reason, we're shutting down.
device->streaming = false;
if(transfers_check_setup(device) == true) if(transfers_check_setup(device) == true)
{ {
// Take lock while cancelling transfers. This blocks the // Take lock while cancelling transfers. This blocks the
@ -1922,7 +1925,6 @@ int ADDCALL hackrf_stop_rx(hackrf_device* device)
{ {
int result; int result;
device->streaming = false;
result = cancel_transfers(device); result = cancel_transfers(device);
if (result != HACKRF_SUCCESS) if (result != HACKRF_SUCCESS)
{ {
@ -1971,7 +1973,6 @@ static int hackrf_stop_tx_cmd(hackrf_device* device)
int ADDCALL hackrf_stop_tx(hackrf_device* device) int ADDCALL hackrf_stop_tx(hackrf_device* device)
{ {
int result; int result;
device->streaming = false;
result = cancel_transfers(device); result = cancel_transfers(device);
if (result != HACKRF_SUCCESS) if (result != HACKRF_SUCCESS)
{ {