Skip to content

buffer_v1: fix false RX dequeue errors over network contexts - #402

Open
999Marius wants to merge 1 commit into
analogdevicesinc:libiio-v1from
999Marius:v1-update
Open

999Marius wants to merge 1 commit into
analogdevicesinc:libiio-v1from
999Marius:v1-update

Conversation

@999Marius

Copy link
Copy Markdown

iio_block_dequeue() only returns 0 on success for the local backend. Over the network/serial/USB iiod-client backend, a successful dequeue returns the number of bytes transferred, which is a positive, non-zero value.

Checking if (ret) treated every successful network RX dequeue as an error, tearing down the buffer and throwing on the very first getSamples() call.

Check ret < 0 instead, matching how iiod_client_dequeue_block() actually reports success/failure.

iio_block_dequeue() only returns 0 on success for the local
backend. Over the network/serial/USB iiod-client backend, a
successful dequeue returns the number of bytes transferred, which
is a positive, non-zero value. Checking `if (ret)` treated every
successful network RX dequeue as an error, tearing down the buffer
and throwing on the very first getSamples() call.

Check `ret < 0` instead, matching how iiod_client_dequeue_block()
actually reports success/failure.

Signed-off-by: Marius Lucacel <marius.lucacel@analog.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant