diff options
author | David Robillard <d@drobilla.net> | 2020-07-08 21:34:07 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-07-08 21:34:07 +0200 |
commit | b0d8894e8dd1b041f0c6643d86d232cf08f71a09 (patch) | |
tree | ebf93248e246ed30283caeec880206b3687bfe92 /src | |
parent | 367e3cbc12ede2a5501fbe8e2baba3115521c20c (diff) | |
download | jalv-b0d8894e8dd1b041f0c6643d86d232cf08f71a09.tar.gz jalv-b0d8894e8dd1b041f0c6643d86d232cf08f71a09.tar.bz2 jalv-b0d8894e8dd1b041f0c6643d86d232cf08f71a09.zip |
Revert "worker: Do not read response when not yet available"
This reverts commit 411f0e67f495fb436ce13ba12c63d7cf874aabd7.
This was merged accidentally.
Diffstat (limited to 'src')
-rw-r--r-- | src/worker.c | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/src/worker.c b/src/worker.c index 8cb09d1..c37c740 100644 --- a/src/worker.c +++ b/src/worker.c @@ -129,36 +129,17 @@ void jalv_worker_emit_responses(JalvWorker* worker, LilvInstance* instance) { if (worker->responses) { - uint32_t read_space = 0; - while (read_space = zix_ring_read_space(worker->responses)) { + uint32_t read_space = zix_ring_read_space(worker->responses); + while (read_space) { uint32_t size = 0; - if (zix_ring_peek(worker->responses, (char*)&size, sizeof(size)) <= 0) { - fprintf(stderr, "error: Response buffer corrupted (req %lu avail %u)\n", - sizeof(size), read_space); - break; - } - - const uint32_t packet_size = sizeof(size) + size; - if (read_space < packet_size) { - fprintf(stderr, "warning: Try to read bigger response (%u) than data available (%u). Retry later.\n", - packet_size, read_space); - break; - } - - if (zix_ring_skip(worker->responses, sizeof(size)) <= 0) { - fprintf(stderr, "error: Response buffer corrupted on skip (req %lu avail %u)\n", - sizeof(size), read_space); - break; - } - - if (zix_ring_read(worker->responses, (char*)worker->response, size) <= 0) { - fprintf(stderr, "error: Response buffer corrupted on read response (req %u avail %u)\n", - size, zix_ring_read_space(worker->responses)); - break; - } + zix_ring_read(worker->responses, (char*)&size, sizeof(size)); + + zix_ring_read(worker->responses, (char*)worker->response, size); worker->iface->work_response( instance->lv2_handle, size, worker->response); + + read_space -= sizeof(size) + size; } } } |